/**
 * Table of contents: 
 * index.js
 * adjustable_servings.js
 * jquery.tools.min.js
 * print_button.js
 * tooltips.js
 * responsive.js
 * jquery.sharrre.min.js
 * sharing_buttons.js
 * partners.js
 * favorite-recipes.js
 * select2.min.js
 * add-to-meal-plan.js
 * timer.js
 * js-quantities.js
 * unit-conversion.js
 * user-menus.js
 * add-to-shopping-list.js
 * user-ratings.js
 * recipe_form.js
 * user-submissions.js
 * meal-planner.js
 * Generated by MagicMin: 2017-06-27 10:09:10
 */
Fraction=function(a,b){if("undefined"!==typeof a&&b)"number"===typeof a&&"number"===typeof b?(this.numerator=a,this.denominator=b):"string"===typeof a&&"string"===typeof b&&(this.numerator=parseInt(a),this.denominator=parseInt(b));else if("undefined"===typeof b)if(num=a,"number"===typeof num)this.numerator=num,this.denominator=1;else if("string"===typeof num){var c,d,e=num.split(" ");e[0]&&(c=e[0]);e[1]&&(d=e[1]);if(0===c%1&&d&&d.match("/"))return(new Fraction(c)).add(new Fraction(d));if(c&&!d)if("string"===
typeof c&&c.match("/"))c=c.split("/"),this.numerator=c[0],this.denominator=c[1];else{if("string"===typeof c&&c.match("."))return new Fraction(parseFloat(c));this.numerator=parseInt(c);this.denominator=1}else return}this.normalize()};Fraction.prototype.clone=function(){return new Fraction(this.numerator,this.denominator)};
Fraction.prototype.toString=function(){if("NaN"===this.denominator)return"NaN";var a=0<this.numerator/this.denominator?Math.floor(this.numerator/this.denominator):Math.ceil(this.numerator/this.denominator),b=this.numerator%this.denominator,c=this.denominator,d=[];0!=a&&d.push(a);0!=b&&d.push((0===a?b:Math.abs(b))+"/"+c);return 0<d.length?d.join(" "):0};Fraction.prototype.rescale=function(a){this.numerator*=a;this.denominator*=a;return this};
Fraction.prototype.add=function(a){var b=this.clone();a=a instanceof Fraction?a.clone():new Fraction(a);td=b.denominator;b.rescale(a.denominator);a.rescale(td);b.numerator+=a.numerator;return b.normalize()};Fraction.prototype.subtract=function(a){var b=this.clone();a=a instanceof Fraction?a.clone():new Fraction(a);td=b.denominator;b.rescale(a.denominator);a.rescale(td);b.numerator-=a.numerator;return b.normalize()};
Fraction.prototype.multiply=function(a){var b=this.clone();if(a instanceof Fraction)b.numerator*=a.numerator,b.denominator*=a.denominator;else if("number"===typeof a)b.numerator*=a;else return b.multiply(new Fraction(a));return b.normalize()};Fraction.prototype.divide=function(a){var b=this.clone();if(a instanceof Fraction)b.numerator*=a.denominator,b.denominator*=a.numerator;else if("number"===typeof a)b.denominator*=a;else return b.divide(new Fraction(a));return b.normalize()};
Fraction.prototype.equals=function(a){a instanceof Fraction||(a=new Fraction(a));var b=this.clone().normalize();a=a.clone().normalize();return b.numerator===a.numerator&&b.denominator===a.denominator};
Fraction.prototype.normalize=function(){var a=function(a){return"number"===typeof a&&(0<a&&0<a%1&&1>a%1||0>a&&0>a%-1&&-1<a%-1)},b=function(a,b){if(b){var c=Math.pow(10,b);return Math.round(a*c)/c}return Math.round(a)};return function(){if(a(this.denominator)){var c=b(this.denominator,9);c=Math.pow(10,c.toString().split(".")[1].length);this.denominator=Math.round(this.denominator*c);this.numerator*=c}if(a(this.numerator)){c=b(this.numerator,9);var d=c.toString().split(".");c=0;void 0!==d[1]&&(c=Math.pow(10,
d[1].length));this.numerator=Math.round(this.numerator*c);this.denominator*=c}c=Fraction.gcf(this.numerator,this.denominator);this.numerator/=c;this.denominator/=c;if(0>this.numerator&&0>this.denominator||0<this.numerator&&0>this.denominator)this.numerator*=-1,this.denominator*=-1;return this}}();
Fraction.gcf=function(a,b){var c=[],d=Fraction.primeFactors(a),e=Fraction.primeFactors(b);d.forEach(function(a){var b=e.indexOf(a);0<=b&&(c.push(a),e.splice(b,1))});return 0===c.length?1:function(){var a=c[0],b;for(b=1;b<c.length;b++)a*=c[b];return a}()};Fraction.primeFactors=function(a){a=Math.abs(a);for(var b=[],c=2;c*c<=a;)0===a%c?(b.push(c),a/=c):c++;1!=a&&b.push(a);return b};
Fraction.prototype.snap=function(a,b){b||(b=1E-4);a||(a=100);for(var c=0>this.numerator,d=this.numerator/this.denominator,e=Math.abs(d%1),d=c?Math.ceil(d):Math.floor(d),f=1;f<=a;++f)for(var g=0;g<=a;++g)if(Math.abs(Math.abs(g/f)-e)<b)return new Fraction(d*f+g*(c?-1:1),f);return new Fraction(this.numerator,this.denominator)};var wpurp_adjustable_servings={updateAmounts:function(a,d,b){a.each(function(){var a=parseFloat(jQuery(this).data("normalized")),e=jQuery(this).data("fraction");d==b?jQuery(this).text(jQuery(this).data("original")):isFinite(a)?(a=wpurp_adjustable_servings.toFixed(b*a/d,e),jQuery(this).text(a)):jQuery(this).addClass("recipe-ingredient-nan")})},toFixed:function(a,d){if(d){var b=Fraction(a.toString()).snap();if(100>b.denominator)return b}if(""==a||0==a)return"";for(var c=parseInt(wpurp_servings.precision),
b=a.toFixed(c);0==parseFloat(b);)if(c++,b=a.toFixed(c),10<c)return"";0<c&&(c=Array(c+1).join("0"),b=b.replace(new RegExp("."+c+"$"),""));"undefined"!==typeof wpurp_servings&&(b=b.replace(".",wpurp_servings.decimal_character));return b}};
jQuery(document).ready(function(){jQuery(document).on("keyup change",".adjust-recipe-servings",function(a){a=jQuery(this);var d=a.parents(".wpurp-container").find(".wpurp-recipe-ingredient-quantity"),b=parseFloat(a.data("original")),c=a.val();if(isNaN(c)||0>=c)c=1;wpurp_adjustable_servings.updateAmounts(d,b,c);RecipePrintButton.update(a.parents(".wpurp-container"))});jQuery(document).on("blur",".adjust-recipe-servings",function(a){a=jQuery(this);var d=a.val();if(isNaN(d)||0>=d)d=1;a.parents(".wpurp-container").find(".adjust-recipe-servings").each(function(){jQuery(this).val(d)});
RecipePrintButton.update(a.parents(".wpurp-container"))})});/*!
 * jQuery Tools v1.2.7 - The missing UI library for the Web
 * 
 * tooltip/tooltip.js
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 */
(function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.on(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).on(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.off(p[0]).on(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.off(p[1]).on(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}})}a.fn.jt_tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);var RecipePrintButton=RecipePrintButton||{};
RecipePrintButton.update=function(b){b.find(".wpurp-recipe-print-button").each(function(){var d=jQuery(this),c=d.data("original-link");c||(c=d.attr("href"),d.data("original-link",c));var a=wpurp_print.permalinks?"/":"=";c.slice(-1)!=a&&(c+=a);if(a=b.find("select.adjust-recipe-unit:visible option:selected").text())a=a.toLowerCase().replace(/ /g,"-").replace(/[-]+/g,"-").replace(/[^\w-]+/g,""),c+=a+"/";a=b.find("input.adjust-recipe-servings:visible");0==a.length&&(a=b.find("input.advanced-adjust-recipe-servings:visible"));
0!=a.length&&(c+=a.val());d.attr("href",c)})};
jQuery(document).ready(function(){jQuery(document).on("click",".wpurp-recipe-print-button, .wpurp-print-recipe-shortcode",function(b){var d=jQuery(this).data("recipe-id");if(d){b.preventDefault();b.stopPropagation();b=jQuery(this).parents(".wpurp-container");wpurp_print.servings_original=parseFloat(b.data("servings-original"));wpurp_print.old_system=parseInt(b.data("system-original"));wpurp_print.new_system=b.find("select.adjust-recipe-unit option:selected").val();wpurp_print.rtl=jQuery("body").hasClass("rtl");
var c=b.find("input.adjust-recipe-servings");0==c.length&&(c=b.find("input.advanced-adjust-recipe-servings"));wpurp_print.servings_new=0==c.length?wpurp_print.servings_original:parseFloat(c.val());wpurp_print.template="";jQuery.post(wpurp_print.ajaxurl,{action:"get_recipe_template",security:wpurp_print.nonce,recipe_id:d},function(a){wpurp_print.template=a.output;wpurp_print.fonts=a.fonts},"json");window.open(wpurp_print.coreUrl+"/templates/print.php","_blank")}})});jQuery(document).ready(function(){jQuery(".recipe-tooltip").length&&(jQuery(".recipe-tooltip").jt_tooltip({offset:[-10,0],effect:"fade",delay:250,relative:!0}),jQuery(".wpupg-grid").find(".recipe-tooltip-content").click(function(a){a.preventDefault();a.stopPropagation()}));jQuery(".wpupg-grid").on("arrangeComplete",function(){jQuery(".wpupg-grid").find(".recipe-tooltip-content").click(function(a){a.preventDefault();a.stopPropagation()})})});var WPURP_Responsive={elementsSelector:".wpurp-container",maxRefreshRate:5,init:function(){var a=this;jQuery(function(){a.el={window:jQuery(window),responsive_elements:jQuery(a.elementsSelector)};a.events()})},checkBreakpointOfAllElements:function(){var a=WPURP_Responsive;jQuery(a.elementsSelector).each(function(e,b){a.checkBreakpointOfElement(jQuery(b))})},checkBreakpointOfElement:function(a){a.width()<wpurp_responsive_data.breakpoint?(a.find(".wpurp-responsive-mobile").css("display","block"),a.find(".wpurp-responsive-desktop").css("display",
"none")):(a.find(".wpurp-responsive-mobile").css("display","none"),a.find(".wpurp-responsive-desktop").css("display","block"))},events:function(){this.checkBreakpointOfAllElements();this.el.window.bind("resize",this.debounce(this.checkBreakpointOfAllElements,this.maxRefreshRate))},debounce:function(a,e,b){var d,c=null;return function(){var f=this,g=arguments,h=b&&!c;clearTimeout(c);c=setTimeout(function(){c=null;b||(d=a.apply(f,g))},e);h&&(d=a.apply(f,g));return d}}};WPURP_Responsive.init();var SharrrePlatform=SharrrePlatform||function(){var a={};return{register:function(b,c){a[b]=c},get:function(b,c){return a[b]?new a[b](c):(console.error("Sharrre - No platform found for "+b),!1)}}}();SharrrePlatform.register("delicious",function(a){return defaultSettings={url:"",urlCount:!1,layout:"1",count:!0,popup:{width:550,height:550}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return"http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?"},trackingAction:{site:"delicious",action:"add"},load:function(a){if("tall"==a.options.buttons.delicious.size)var b="width:50px;",c="height:35px;width:50px;font-size:15px;line-height:35px;",d="height:18px;line-height:18px;margin-top:3px;";else var b="width:93px;",c="float:right;padding:0 3px;height:20px;width:26px;line-height:20px;",d="float:left;height:20px;line-height:20px;";var e=a.shorterTotal(a.options.count.delicious);"undefined"==typeof e&&(e=0),jQuery(a.element).find(".buttons").append('<div class="button delicious"><div style="'+b+'font:12px Arial,Helvetica,sans-serif;cursor:pointer;color:#666666;display:inline-block;float:none;height:20px;line-height:normal;margin:0;padding:0;text-indent:0;vertical-align:baseline;"><div style="'+c+'background-color:#fff;margin-bottom:5px;overflow:hidden;text-align:center;border:1px solid #ccc;border-radius:3px;">'+e+'</div><div style="'+d+'display:block;padding:0;text-align:center;text-decoration:none;width:50px;background-color:#7EACEE;border:1px solid #40679C;border-radius:3px;color:#fff;"><img src="https://www.delicious.com/static/img/delicious.small.gif" height="10" width="10" alt="Delicious" /> Add</div></div></div>'),jQuery(a.element).find(".delicious").on("click",function(){a.openPopup("delicious")})},tracking:function(){},popup:function(a){window.open("https://www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent(""!==this.settings.url?this.settings.url:a.url)+"&title="+a.text,"delicious","toolbar=no,width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("digg",function(a){return defaultSettings={url:"",urlCount:!1,type:"DiggCompact",count:!0,popup:{width:650,height:360}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return"http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?"},trackingAction:{site:"digg",action:"add"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button digg"><a class="DiggThisButton '+b.type+'" rel="nofollow external" href="http://digg.com/submit?url='+encodeURIComponent(""!==b.url?b.url:a.options.url)+'"></a></div>');var c=0;"undefined"==typeof __DBW&&0==c&&(c=1,function(){var a=document.createElement("SCRIPT"),b=document.getElementsByTagName("SCRIPT")[0];a.type="text/javascript",a.async=!0,a.src="http://widgets.digg.com/buttons.js",b.parentNode.insertBefore(a,b)}())},tracking:function(){},popup:function(a){window.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent(""!==a.buttons.digg.url?a.buttons.digg.url:a.url)+"&title="+a.text+"&related=true&style=true","","toolbar=0, status=0, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("facebook",function(a){return defaultSettings={url:"",urlCount:!1,action:"like",layout:"button_count",count:!0,width:"",send:"false",faces:"false",colorscheme:"",font:"",lang:"en_US",share:"",appId:"",popup:{width:900,height:500}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?"},trackingAction:{site:"facebook",action:"like"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button facebook"><div id="fb-root"></div><div class="fb-like" data-href="'+(""!==b.url?b.url:a.options.url)+'" data-send="'+b.send+'" data-layout="'+b.layout+'" data-width="'+b.width+'" data-show-faces="'+b.faces+'" data-action="'+b.action+'" data-colorscheme="'+b.colorscheme+'" data-font="'+b.font+'" data-via="'+b.via+'" data-share="'+b.share+'"></div></div>');var c=0;"undefined"==typeof FB&&0==c?(c=1,function(a,c,d){var e,f=a.getElementsByTagName(c)[0];a.getElementById(d)||(e=a.createElement(c),e.id=d,e.src="https://connect.facebook.net/"+b.lang+"/all.js#xfbml=1",b.appId&&(e.src+="&appId="+b.appId),f.parentNode.insertBefore(e,f))}(document,"script","facebook-jssdk")):FB.XFBML.parse()},tracking:function(){fb=window.setInterval(function(){"undefined"!=typeof FB&&(FB.Event.subscribe("edge.create",function(a){_gaq.push(["_trackSocial","facebook","like",a])}),FB.Event.subscribe("edge.remove",function(a){_gaq.push(["_trackSocial","facebook","unlike",a])}),FB.Event.subscribe("message.send",function(a){_gaq.push(["_trackSocial","facebook","send",a])}),clearInterval(fb))},1e3)},popup:function(a){window.open("https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(""!==this.settings.url?this.settings.url:a.url)+"&t="+a.text,"","toolbar=0, status=0, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("googlePlus",function(a){return defaultSettings={url:"",urlCount:!1,size:"medium",lang:"en-US",annotation:"",count:!0,popup:{width:900,height:500}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return a+"?url={url}&type=googlePlus"},trackingAction:{site:"Google",action:"+1"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button googleplus"><div class="g-plusone" data-size="'+b.size+'" data-href="'+(""!==b.url?b.url:a.options.url)+'" data-annotation="'+b.annotation+'"></div></div>'),window.___gcfg={lang:b.lang};var c=0;"undefined"!=typeof gapi&&"undefined"!=typeof gapi.plusone||0!=c?gapi.plusone.go():(c=1,function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://apis.google.com/js/plusone.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}())},tracking:function(){},popup:function(a){window.open("https://plus.google.com/share?hl="+a.buttons.googlePlus.lang+"&url="+encodeURIComponent(""!==a.buttons.googlePlus.url?a.buttons.googlePlus.url:a.url),"","toolbar=0, status=0, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("linkedin",function(a){return defaultSettings={url:"",urlCount:!1,counter:"",count:!0,popup:{width:550,height:550}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return"https://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?"},trackingAction:{site:"linkedin",action:"share"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button linkedin"><script type="IN/share" data-url="'+(""!==b.url?b.url:a.options.url)+'" data-counter="'+b.counter+'"></script></div>');var c=0;"undefined"==typeof window.IN&&0==c?(c=1,function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://platform.linkedin.com/in.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}()):"undefined"!=typeof window.IN&&window.IN.parse&&IN.parse(document)},tracking:function(){},popup:function(a){window.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent(""!==a.buttons.linkedin.url?a.buttons.linkedin.url:a.url)+"&token=&isFramed=true","linkedin","toolbar=no, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("pinterest",function(a){return defaultSettings={url:"",media:"",description:"",layout:"horizontal",popup:{width:700,height:300}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return"https://api.pinterest.com/v1/urls/count.json?url={url}&callback=?"},trackingAction:{site:"pinterest",action:"pin"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button pinterest"><a href="https://www.pinterest.com/pin/create/button/?url='+(""!==b.url?b.url:a.options.url)+"&media="+b.media+"&description="+b.description+'" data-pin-do="buttonBookmark" count-layout="'+b.layout+'">Pin It</a></div>'),function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://assets.pinterest.com/js/pinit.js",a.setAttribute("data-pin-build","parsePinBtns");var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}(),window.parsePinBtns&&window.parsePinBtns(),jQuery(a.element).find(".pinterest").on("click",function(){a.openPopup("pinterest")})},tracking:function(){},popup:function(a){window.open("https://pinterest.com/pin/create/button/?url="+encodeURIComponent(""!==a.buttons.pinterest.url?a.buttons.pinterest.url:a.url)+"&media="+encodeURIComponent(a.buttons.pinterest.media)+"&description="+a.buttons.pinterest.description,"pinterest","toolbar=no,width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("reddit",function(a){return defaultSettings={url:"",urlCount:!1,count:!1,popup:{width:900,height:550}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,trackingAction:{site:"reddit",action:"share"},url:function(a){return""},load:function(a){var b=this.settings,c=this;jQuery(a.element).find(".buttons").append('<div class="button reddit"><a href="https://www.reddit.com/submit?url='+(""!==b.url?b.url:a.options.url)+'"><img src="https://www.redditstatic.com/spreddit7.gif" alt="submit to reddit" border="0" /></a></div>'),jQuery(a.element).find(".reddit").on("click",function(){c.popup(a.options)})},tracking:function(){},popup:function(a){window.open("https://www.reddit.com/submit?url="+encodeURIComponent(""!==this.settings.url?this.setting.url:a.url),"","toolbar=0, status=0,width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("stumbleupon",function(a){return defaultSettings={url:"",urlCount:!1,size:"medium",count:!0,popup:{width:550,height:550}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return a+"?url={url}&type=stumbleupon"},trackingAction:{site:"stumbleupon",action:"add"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button stumbleupon"><su:badge layout="'+b.layout+'" location="'+(""!==b.url?b.url:a.options.url)+'"></su:badge></div>');var c=0;"undefined"==typeof STMBLPN&&0==c?(c=1,function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://platform.stumbleupon.com/1/widgets.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}(),s=window.setTimeout(function(){"undefined"!=typeof STMBLPN&&(STMBLPN.processWidgets(),clearInterval(s))},500)):(STMBLPN.wasProcessLoaded=!1,STMBLPN.processWidgets())},tracking:function(){},popup:function(a){window.open("https://www.stumbleupon.com/badge/?url="+encodeURIComponent(""!==a.buttons.stumbleupon.url?a.buttons.stumbleupon.url:a.url),"stumbleupon","toolbar=no, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("tumblr",function(a){return defaultSettings={url:"",urlCount:!1,description:"",name:"",count:!1,title:"Share on Tumblr",color:"blue",notes:"none",popup:{width:900,height:500}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,url:function(a){return""},trackingAction:{site:"tumblr",action:"share"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div title="'+b.title+'" class="button tumblr"><a class="tumblr-share-button" data-color="'+b.color+'" data-notes="'+b.notes+'" data-href="'+(""!==b.url?b.url:a.options.url)+'"  href="https://www.tumblr.com/share">'+b.title+"</a></div>");var c=0;"undefined"==typeof Tumblr&&0==c?(c=1,function(){var a=document.createElement("script"),b=document.getElementsByTagName("script")[0];a.src="https://secure.assets.tumblr.com/share-button.js",b.parentNode.insertBefore(a,b)}()):Tumblr.activate_share_on_tumblr_buttons()},tracking:function(){},popup:function(a){window.open("https://www.tumblr.com/share/link?canonicalUrl="+encodeURIComponent(""!==this.settings.url?this.settings.url:a.url)+"&name="+encodeURIComponent(this.settings.name)+"&description="+encodeURIComponent(this.settings.description),"","toolbar=0, status=0, width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("twitter",function(a){return defaultSettings={url:"",urlCount:!1,count:!1,hashtags:"",via:"",related:"",lang:"en",popup:{width:650,height:360}},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,trackingAction:{site:"twitter",action:"tweet"},url:function(a){return"https://opensharecount.com/count.json?url={url}"},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="'+(""!==b.url?b.url:a.options.url)+'" data-count="'+b.count+'" data-text="'+a.options.text+'" data-via="'+b.via+'" data-hashtags="'+b.hashtags+'" data-related="'+b.related+'" data-lang="'+b.lang+'">Tweet</a></div>');var c=0;"undefined"==typeof twttr&&0==c?(c=1,function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://platform.twitter.com/widgets.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}()):jQuery.ajax({url:"https://platform.twitter.com/widgets.js",dataType:"script",cache:!0})},tracking:function(){tw=window.setInterval(function(){"undefined"!=typeof twttr&&(twttr.events.bind("tweet",function(a){a&&_gaq.push(["_trackSocial","twitter","tweet"])}),clearInterval(tw))},1e3)},popup:function(a){window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(a.text)+"&url="+encodeURIComponent(""!==this.settings.url?this.setting.url:a.url)+(""!==this.settings.via?"&via="+this.settings.via:""),"","toolbar=0, status=0,width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),SharrrePlatform.register("twitterFollow",function(a){return defaultSettings={url:"",urlCount:!1,count:!0,display:"horizontal",lang:"en",popup:{width:650,height:360},user:"",size:"default",showCount:"false"},defaultSettings=jQuery.extend(!0,{},defaultSettings,a),{settings:defaultSettings,trackingAction:{site:"twitter",action:"follow"},url:function(a){return""},load:function(a){var b=this.settings;jQuery(a.element).find(".buttons").append('<div class="button twitterFollow"><a href="https://twitter.com/'+b.user+'" class="twitter-follow-button"" data-size="'+b.size+'" data-show-count="'+b.showCount+'" data-lang="'+b.lang+'">Follow @'+b.user+"</a></div>");var c=0;"undefined"==typeof twttr&&0==c?(c=1,function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://platform.twitter.com/widgets.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}()):jQuery.ajax({url:"https://platform.twitter.com/widgets.js",dataType:"script",cache:!0})},tracking:function(){},popup:function(a){window.open("https://twitter.com/intent/follow?screen_name="+encodeURIComponent(this.settings.user),"","toolbar=0, status=0, ,width="+this.settings.popup.width+", height="+this.settings.popup.height)}}}),/*!
 *  Sharrre.com - Make your sharing widget!
 *  Version: 2.0.0
 *  Author: Julien Hany
 *  License: MIT http://en.wikipedia.org/wiki/MIT_License or GPLv2 http://en.wikipedia.org/wiki/GNU_General_Public_License
 */
function(a,b,c,d){function f(b,c){this.element=b,this.options=a.extend(!0,{},h,c),this.options.share=c.share,this._defaults=h,this._name=g,this.platforms={},this.init()}var g="sharrre",h={className:"sharrre",share:{},shareTotal:0,template:"",title:"",url:c.location.href,text:c.title,urlCurl:"sharrre.php",count:{},total:0,shorterTotal:!0,enableHover:!0,enableCounter:!0,enableTracking:!1,defaultUrl:"javascript:void(0);",popup:{width:900,height:500},hover:function(){},hide:function(){},click:function(){},render:function(){}};f.prototype.init=function(){var b=this;a.each(b.options.share,function(a,c){c===!0&&(b.platforms[a]=SharrrePlatform.get(a,b.options.buttons[a]))}),a(this.element).addClass(this.options.className),"undefined"!=typeof a(this.element).data("title")&&(this.options.title=a(this.element).attr("data-title")),"undefined"!=typeof a(this.element).data("url")&&(this.options.url=a(this.element).data("url")),"undefined"!=typeof a(this.element).data("text")&&(this.options.text=a(this.element).data("text")),a.each(this.options.share,function(a,c){c===!0&&b.options.shareTotal++}),b.options.enableCounter===!0?a.each(this.options.share,function(a,c){if(c===!0)try{b.getSocialJson(a)}catch(d){}}):""!==b.options.template&&(b.renderer(),b.options.count[name]=0,b.rendererPerso()),""!==b.options.template?this.options.render(this,this.options):this.loadButtons(),a(this.element).on("mouseenter",function(){0===a(this).find(".buttons").length&&b.options.enableHover===!0&&b.loadButtons(),b.options.hover(b,b.options)}).on("mouseleave",function(){b.options.hide(b,b.options)}),a(this.element).click(function(a){return a.preventDefault(),b.options.click(b,b.options),!1})},f.prototype.loadButtons=function(){var b=this;a(this.element).append('<div class="buttons"></div>'),a.each(b.options.share,function(a,c){1==c&&(b.platforms[a].load(b),b.options.enableTracking===!0&&b.platforms[a].tracking())})},f.prototype.getSocialJson=function(b){var c=this,d=0,e=c.platforms[b].settings,f=c.platforms[b].url(this.options.urlCurl),g=encodeURIComponent(this.options.url);e.url.length&&(f=e.url),e.urlCount===!0&&""!==f&&(g=f),e.count===!1&&(f=""),url=f.replace("{url}",g),""!=url?a.getJSON(url,function(a){if("undefined"!=typeof a.count){var e=a.count+"";e=e.replace("Â ",""),d+=parseInt(e,10)}else a.data&&a.data.length>0&&"undefined"!=typeof a.data[0].total_count?d+=parseInt(a.data[0].total_count,10):"undefined"!=typeof a[0]?d+=parseInt(a[0].total_posts,10):"undefined"!=typeof a[0];c.options.count[b]=d,c.options.total+=d,c.renderer(),c.rendererPerso()}).error(function(){c.options.count[b]=0,c.rendererPerso()}):(c.renderer(),c.options.count[b]=0,c.rendererPerso())},f.prototype.rendererPerso=function(){var a=0;for(e in this.options.count)a++;a===this.options.shareTotal&&this.options.render(this,this.options)},f.prototype.renderer=function(){var b=this.options.total,c=this.options.template;this.options.shorterTotal===!0&&(b=this.shorterTotal(b)),""!==c?(c=c.replace("{total}",b),a(this.element).html(c)):a(this.element).html('<div class="box"><a class="count" href="'+this.options.defaultUrl+'">'+b+"</a>"+(""!==this.options.title?'<a class="share" href="'+this.options.defaultUrl+'">'+this.options.title+"</a>":"")+"</div>")},f.prototype.shorterTotal=function(a){return a>=1e6?a=(a/1e6).toFixed(2)+"M":a>=1e3&&(a=(a/1e3).toFixed(1)+"k"),a},f.prototype.openPopup=function(a){this.platforms[a].popup(this.options),this.options.enableTracking===!0&&(infos=this.platforms[a].trackingAction,_gaq.push(["_trackSocial",infos.site,infos.action]))},f.prototype.simulateClick=function(){var b=a(this.element).html();a(this.element).html(b.replace(this.options.total,this.options.total+1))},f.prototype.update=function(a,b){""!==a&&(this.options.url=a),""!==b&&(this.options.text=b)},a.fn[g]=function(b){var c=arguments;return b===d||"object"==typeof b?this.each(function(){a(this).data("plugin_"+g)||a(this).data("plugin_"+g,new f(this,b))}):"string"==typeof b&&"_"!==b[0]&&"init"!==b?this.each(function(){var d=a(this).data("plugin_"+g);d instanceof f&&"function"==typeof d[b]&&d[b].apply(d,Array.prototype.slice.call(c,1))}):void 0}}(window.jQuery||window.Zepto,window,document);jQuery(document).ready(function(){jQuery(".wpurp-twitter").each(function(c,b){var a=jQuery(b);a.sharrre({share:{twitter:!0},buttons:{twitter:{count:jQuery(a).data("layout"),lang:wpurp_sharing_buttons.twitter_lang}},enableHover:!1,enableCounter:!1,enableTracking:!1})});jQuery(".wpurp-facebook").each(function(c,b){var a=jQuery(b);a.sharrre({share:{facebook:!0},buttons:{facebook:{action:"like",layout:jQuery(a).data("layout"),share:jQuery(a).data("share"),lang:wpurp_sharing_buttons.facebook_lang}},enableHover:!1,
enableCounter:!1,enableTracking:!1})});jQuery(".wpurp-google").each(function(c,b){var a=jQuery(b);a.sharrre({share:{googlePlus:!0},buttons:{googlePlus:{size:jQuery(a).data("layout"),annotation:jQuery(a).data("annotation"),lang:wpurp_sharing_buttons.google_lang}},enableHover:!1,enableCounter:!1,enableTracking:!1})});jQuery(".wpurp-pinterest").each(function(c,b){var a=jQuery(b);a.sharrre({share:{pinterest:!0},buttons:{pinterest:{url:jQuery(a).data("url"),media:jQuery(a).data("media"),description:jQuery(a).data("description"),
layout:jQuery(a).data("layout")}},enableHover:!1,enableCounter:!1,enableTracking:!1,click:function(a,b){a.openPopup("pinterest")}})});jQuery(".wpurp-stumbleupon").each(function(c,b){var a=jQuery(b);a.sharrre({share:{stumbleupon:!0},buttons:{stumbleupon:{layout:jQuery(a).data("layout")}},enableHover:!1,enableCounter:!1,enableTracking:!1})});jQuery(".wpurp-linkedin").each(function(c,b){var a=jQuery(b);a.sharrre({share:{linkedin:!0},buttons:{linkedin:{counter:jQuery(a).data("layout")}},enableHover:!1,
enableCounter:!1,enableTracking:!1})})});function wpurp_bigoven(){var a=document.createElement("script");a.type="text/javascript";a.src="https://www.bigoven.com/assets/noexpire/js/getrecipe.js?"+(new Date).getTime()/1E5;document.getElementsByTagName("head")[0].appendChild(a)};jQuery(document).ready(function(){jQuery(document).on("click",".wpurp-recipe-favorite",function(c){c.preventDefault();c.stopPropagation();var d=jQuery(this),a=d.find("i");c=d.data("recipe-id");jQuery.post(wpurp_favorite_recipe.ajaxurl,{action:"favorite_recipe",security:wpurp_favorite_recipe.nonce,recipe_id:c},function(b){b=a.data("icon");var e=a.data("icon-alt");a.hasClass(b)?(a.removeClass(b),a.addClass(e)):(a.removeClass(e),a.addClass(b));if(d.next().hasClass("recipe-tooltip-content")){b=d.next().find(".tooltip-shown").first();
var e=d.next().find(".tooltip-alt").first(),c=b.html(),f=e.html();b.html(f);e.html(c)}})})});/*
Copyright 2012 Igor Vaynberg

Version: 3.4.5 Timestamp: Mon Nov  4 08:22:42 PST 2013

This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
General Public License version 2 (the "GPL License"). You may choose either license to govern your
use of this software only upon the condition that you accept all of the terms of either the Apache
License or the GPL License.

You may obtain a copy of the Apache License and the GPL License at:

http://www.apache.org/licenses/LICENSE-2.0
http://www.gnu.org/licenses/gpl-2.0.html

Unless required by applicable law or agreed to in writing, software distributed under the Apache License
or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the Apache License and the GPL License for the specific language governing
permissions and limitations under the Apache License and the GPL License.
*/
!function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function n(a){var b,c,d,e;if(!a||a.length<1)return a;for(b="",c=0,d=a.length;d>c;c++)e=a.charAt(c),b+=m[e]||e;return b}function o(a,b){for(var c=0,d=b.length;d>c;c+=1)if(q(a,b[c]))return c;return-1}function p(){var b=a(l);b.appendTo("body");var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function q(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function r(b,c){var d,e,f;if(null===b||b.length<1)return[];for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d}function s(a){return a.outerWidth(!1)-a.width()}function t(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function u(c){c.on("mousemove",function(c){var d=i;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function v(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function w(a){var c,b=!1;return function(){return b===!1&&(c=a(),b=!0),c}}function x(a,b){var c=v(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){o(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus(),a.is(":visible")&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!h){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);h=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),h.attr("class","select2wpurp-sizer"),a("body").append(h)}return h.text(b.val()),h.width()}function D(b,c,d){var e,g,f=[];e=b.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0===this.indexOf("select2wpurp-")&&f.push(this)})),e=c.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0!==this.indexOf("select2wpurp-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=n(a.toUpperCase()).indexOf(n(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push("<span class='select2wpurp-match'>"),c.push(d(a.substring(e,e+f))),c.push("</span>"),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2wpurp.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2wpurp.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page);i.callback(b)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]};a(d?c():c).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g)}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;throw new Error(c+" must be a function or a falsy value")}function K(b){return a.isFunction(b)?b():b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(q(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2wpurp===b){var c,d,e,f,g,h,j,k,i={x:0,y:0},c={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case c.LEFT:case c.RIGHT:case c.UP:case c.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case c.SHIFT:case c.CTRL:case c.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="<div class='select2wpurp-measure-scrollbar'></div>",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z"};j=a(document),g=function(){var a=1;return function(){return a++}}(),j.on("mousemove",function(a){i.x=a.pageX,i.y=a.pageY}),d=N(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,f=".select2wpurp-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2wpurp")!==b&&null!==c.element.data("select2wpurp")&&c.element.data("select2wpurp").destroy(),this.container=this.createContainer(),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+g()),this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.body=w(function(){return c.element.closest("body")}),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss)),this.container.addClass(K(c.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2wpurp",this).attr("tabindex","-1").before(this.container).on("click.select2wpurp",A),this.container.data("select2wpurp",this),this.dropdown=this.container.find(".select2wpurp-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass)),this.dropdown.data("select2wpurp",this),this.dropdown.on("click",A),this.results=d=this.container.find(f),this.search=e=this.container.find("input.select2wpurp-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),u(this.results),this.dropdown.on("mousemove-filtered touchstart touchmove touchend",f,this.bind(this.highlightUnderEvent)),x(80,this.results),this.dropdown.on("scroll-debounced",f,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2wpurp-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2wpurp-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),t(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2wpurp-focused")}),e.on("blur",function(){e.removeClass("select2wpurp-focused")}),this.dropdown.on("mouseup",f,this.bind(function(b){a(b.target).closest(".select2wpurp-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown",function(a){a.stopPropagation()}),a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),k=k||p(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.nextSearchTerm=b},destroy:function(){var a=this.opts.element,c=a.data("select2wpurp");this.close(),this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),c!==b&&(c.container.remove(),c.dropdown.remove(),a.removeClass("select2wpurp-offscreen").removeData("select2wpurp").off(".select2wpurp").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show())},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:q(a.attr("locked"),"locked")||q(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,f,g,h=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2wpurp when attached to a <select> element.")}),c=a.extend({},{populateResults:function(d,e,f){var g,i=this.opts.id;g=function(d,e,j){var k,l,m,n,o,p,q,r,s,t;for(d=c.sortResults(d,e,f),k=0,l=d.length;l>k;k+=1)m=d[k],o=m.disabled===!0,n=!o&&i(m)!==b,p=m.children&&m.children.length>0,q=a("<li></li>"),q.addClass("select2wpurp-results-dept-"+j),q.addClass("select2wpurp-result"),q.addClass(n?"select2wpurp-result-selectable":"select2wpurp-result-unselectable"),o&&q.addClass("select2wpurp-disabled"),p&&q.addClass("select2wpurp-result-with-children"),q.addClass(h.opts.formatResultCssClass(m)),r=a(document.createElement("div")),r.addClass("select2wpurp-result-label"),t=c.formatResult(m,r,f,h.opts.escapeMarkup),t!==b&&r.html(t),q.append(r),p&&(s=a("<ul></ul>"),s.addClass("select2wpurp-result-sub"),g(m.children,s,j+1),q.append(s)),q.data("select2wpurp-data",m),e.append(q)},g(e,d,0)}},a.fn.select2wpurp.defaults,c),"function"!=typeof c.id&&(f=c.id,c.id=function(a){return a[f]}),a.isArray(c.element.data("select2wpurpTags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2wpurp-tags' and in options of Select2wpurp "+c.element.attr("id");c.tags=c.element.data("select2wpurpTags")}if(e?(c.query=this.bind(function(a){var f,g,i,c={results:[],more:!1},e=a.term;i=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(h.optionToData(b)):b.is("optgroup")&&(d=h.optionToData(b),b.children().each2(function(a,b){i(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){i(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id},c.formatResultCssClass=function(a){return a.css}):"query"in c||("ajax"in c?(g=c.element.data("ajax-url"),g&&g.length>0&&(c.ajax.url=g),c.query=G.call(c.element,c.ajax)):"data"in c?c.query=H(c.data):"tags"in c&&(c.query=I(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(r(b.val(),c.separator)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){return q(this.id,b.id)?(b=this,!1):void 0}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2wpurp "+c.element.attr("id");return c},monitorSource:function(){var c,d,a=this.opts.element;a.on("change.select2wpurp",this.bind(function(){this.opts.element.data("select2wpurp-change-triggered")!==!0&&this.initSelection()})),c=this.bind(function(){var c=a.prop("disabled");c===b&&(c=!1),this.enable(!c);var d=a.prop("readonly");d===b&&(d=!1),this.readonly(d),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(K(this.opts.containerCssClass)),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(this.opts.dropdownCssClass))}),a.on("propertychange.select2wpurp",c),this.mutationCallback===b&&(this.mutationCallback=function(a){a.forEach(c)}),d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,d!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new d(this.mutationCallback),this.propertyObserver.observe(a.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2wpurp-selecting",{val:this.id(b),object:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2wpurp-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2wpurp-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2wpurp-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){return a===b&&(a=!1),this._readonly===a?!1:(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface(),!0)},opened:function(){return this.container.hasClass("select2wpurp-dropdown-open")},positionDropdown:function(){var t,u,v,w,x,b=this.dropdown,c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),g=a(window),h=g.width(),i=g.height(),j=g.scrollLeft()+h,l=g.scrollTop()+i,m=c.top+d,n=c.left,o=l>=m+f,p=c.top-f>=this.body().scrollTop(),q=b.outerWidth(!1),r=j>=n+q,s=b.hasClass("select2wpurp-drop-above");s?(u=!0,!p&&o&&(v=!0,u=!1)):(u=!1,!o&&p&&(v=!0,u=!0)),v&&(b.hide(),c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),j=g.scrollLeft()+h,l=g.scrollTop()+i,m=c.top+d,n=c.left,q=b.outerWidth(!1),r=j>=n+q,b.show()),this.opts.dropdownAutoWidth?(x=a(".select2wpurp-results",b)[0],b.addClass("select2wpurp-drop-auto-width"),b.css("width",""),q=b.outerWidth(!1)+(x.scrollHeight===x.clientHeight?0:k.width),q>e?e=q:q=e,r=j>=n+q):this.container.removeClass("select2wpurp-drop-auto-width"),"static"!==this.body().css("position")&&(t=this.body().offset(),m-=t.top,n-=t.left),r||(n=c.left+e-q),w={left:n,width:e},u?(w.bottom=i-c.top,w.top="auto",this.container.addClass("select2wpurp-drop-above"),b.addClass("select2wpurp-drop-above")):(w.top=m,w.bottom="auto",this.container.removeClass("select2wpurp-drop-above"),b.removeClass("select2wpurp-drop-above")),w=a.extend(w,K(this.opts.dropdownCss)),b.css(w)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2wpurp-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2wpurp-drop-above"),this.dropdown.removeClass("select2wpurp-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),!0):!1},opening:function(){var f,b=this.containerId,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2wpurp-dropdown-open").addClass("select2wpurp-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body()),f=a("#select2wpurp-drop-mask"),0==f.length&&(f=a(document.createElement("div")),f.attr("id","select2wpurp-drop-mask").attr("class","select2wpurp-drop-mask"),f.hide(),f.appendTo(this.body()),f.on("mousedown touchstart click",function(b){var d,c=a("#select2wpurp-drop");c.length>0&&(d=c.data("select2wpurp"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close({focus:!0}),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2wpurp-drop").removeAttr("id"),this.dropdown.attr("id","select2wpurp-drop"),f.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2wpurp-drop-active");var g=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(){g.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerId,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2wpurp-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2wpurp-dropdown-open").removeClass("select2wpurp-container-active"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2wpurp-active"),this.opts.element.trigger(a.Event("select2wpurp-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return K(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var c,d,e,f,g,h,i,b=this.results;if(d=this.highlight(),!(0>d)){if(0==d)return b.scrollTop(0),void 0;c=this.findHighlightableChoices().find(".select2wpurp-result-label"),e=a(c[d]),f=e.offset().top+e.outerHeight(!0),d===c.length-1&&(i=b.find("li.select2wpurp-more-results"),i.length>0&&(f=i.offset().top+i.outerHeight(!0))),g=b.offset().top+b.outerHeight(!0),f>g&&b.scrollTop(b.scrollTop()+(f-g)),h=e.offset().top-b.offset().top,0>h&&"none"!=e.css("display")&&b.scrollTop(b.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2wpurp-result-selectable:not(.select2wpurp-disabled, .select2wpurp-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d<c.length;){d+=b;var e=a(c[d]);if(e.hasClass("select2wpurp-result-selectable")&&!e.hasClass("select2wpurp-disabled")&&!e.hasClass("select2wpurp-selected")){this.highlight(d);break}}},highlight:function(b){var d,e,c=this.findHighlightableChoices();return 0===arguments.length?o(c.filter(".select2wpurp-highlighted")[0],c.get()):(b>=c.length&&(b=c.length-1),0>b&&(b=0),this.removeHighlight(),d=a(c[b]),d.addClass("select2wpurp-highlighted"),this.ensureHighlightVisible(),e=d.data("select2wpurp-data"),e&&this.opts.element.trigger({type:"select2wpurp-highlight",val:this.id(e),choice:e}),void 0)},removeHighlight:function(){this.results.find(".select2wpurp-highlighted").removeClass("select2wpurp-highlighted")},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2wpurp-result-selectable");if(c.length>0&&!c.is(".select2wpurp-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2wpurp-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),c<=this.opts.loadMorePadding&&(b.addClass("select2wpurp-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),e.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).text(e.opts.formatLoadMore(d+1)),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d,e.context=c.context,this.opts.element.trigger({type:"select2wpurp-loaded",items:c}))})})))},tokenize:function(){},updateResults:function(c){function m(){d.removeClass("select2wpurp-active"),h.positionDropdown()}function n(a){e.html(a),m()}var g,i,l,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2wpurp-last-term");if((c===!0||!k||!q(j,k))&&(a.data(this.container,"select2wpurp-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var o=this.getMaximumSelectionSize();if(o>=1&&(g=this.data(),a.isArray(g)&&g.length>=o&&J(f.formatSelectionTooBig,"formatSelectionTooBig")))return n("<li class='select2wpurp-selection-limit'>"+f.formatSelectionTooBig(o)+"</li>"),void 0;if(d.val().length<f.minimumInputLength)return J(f.formatInputTooShort,"formatInputTooShort")?n("<li class='select2wpurp-no-results'>"+f.formatInputTooShort(d.val(),f.minimumInputLength)+"</li>"):n(""),c&&this.showSearch&&this.showSearch(!0),void 0;
if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return J(f.formatInputTooLong,"formatInputTooLong")?n("<li class='select2wpurp-no-results'>"+f.formatInputTooLong(d.val(),f.maximumInputLength)+"</li>"):n(""),void 0;f.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2wpurp-searching'>"+f.formatSearching()+"</li>"),d.addClass("select2wpurp-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return this.search.removeClass("select2wpurp-active"),void 0;if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return q(h.id(this),h.id(i))}).length&&g.results.unshift(i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n("<li class='select2wpurp-no-results'>"+f.formatNoMatches(d.val())+"</li>"),void 0;e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2wpurp-more-results'>"+h.opts.escapeMarkup(f.formatLoadMore(this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2wpurp-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2wpurp-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2wpurp-search-choice-focus").removeClass("select2wpurp-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){var b=this.highlight(),c=this.results.find(".select2wpurp-highlighted"),d=c.closest(".select2wpurp-result").data("select2wpurp-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var a=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&a||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.text()&&""===a.val())return a}},initContainerWidth:function(){function c(){var c,d,e,f,g,h;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(h=d[f].replace(/\s/g,""),e=h.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),e=N(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2wpurp-container"}).html(["<a href='javascript:void(0)' onclick='return false;' class='select2wpurp-choice' tabindex='-1'>","   <span class='select2wpurp-chosen'>&nbsp;</span><abbr class='select2wpurp-search-choice-close'></abbr>","   <span class='select2wpurp-arrow'><b></b></span>","</a>","<input class='select2wpurp-focusser select2wpurp-offscreen' type='text'/>","<div class='select2wpurp-drop select2wpurp-display-none'>","   <div class='select2wpurp-search'>","       <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2wpurp-input'/>","   </div>","   <ul class='select2wpurp-results'>","   </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var c,d,e;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.search.focus(),c=this.search.get(0),c.createTextRange?(d=c.createTextRange(),d.collapse(!1),d.select()):c.setSelectionRange&&(e=this.search.val().length,c.setSelectionRange(e,e)),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2wpurp-open"))},close:function(a){this.opened()&&(this.parent.close.apply(this,arguments),a=a||{focus:!0},this.focusser.removeAttr("disabled"),a.focus&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.removeAttr("disabled"),this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2wpurp-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments)},initContainer:function(){var b,d=this.container,e=this.dropdown;this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=d.find(".select2wpurp-choice"),this.focusser=d.find(".select2wpurp-focusser"),this.focusser.attr("id","s2id_autogen"+g()),a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.focusser.attr("id")),this.focusser.attr("tabindex",this.elementTabIndex),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){if(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)return A(a),void 0;switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case c.ESC:return this.cancel(a),A(a),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind(function(){this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.ESC){if(this.opts.openOnEnter===!1&&a.which===c.ENTER)return A(a),void 0;if(a.which==c.DOWN||a.which==c.UP||a.which==c.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),A(a),void 0}return a.which==c.DELETE||a.which==c.BACKSPACE?(this.opts.allowClear&&this.clear(),A(a),void 0):void 0}})),t(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection.focus())})),b.on("mousedown",this.bind(function(b){this.container.hasClass("select2wpurp-container-active")||this.opts.element.trigger(a.Event("select2wpurp-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(b)})),e.on("mousedown",this.bind(function(){this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2wpurp-container-active")||this.opts.element.trigger(a.Event("select2wpurp-focus")),this.container.addClass("select2wpurp-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2wpurp-container-active"),this.opts.element.trigger(a.Event("select2wpurp-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2wpurp-container-active")||this.opts.element.trigger(a.Event("select2wpurp-focus")),this.container.addClass("select2wpurp-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2wpurp-offscreen"),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2wpurp-data");if(c){var d=a.Event("select2wpurp-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2wpurp-chosen").empty(),this.selection.removeData("select2wpurp-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2wpurp-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder())})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()?(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val():!1},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=q(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2wpurp-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2wpurp-default"),this.container.removeClass("select2wpurp-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return q(e.id(b.data("select2wpurp-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2wpurp-search").toggleClass("select2wpurp-search-hidden",!b),this.dropdown.find(".select2wpurp-search").toggleClass("select2wpurp-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2wpurp-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2wpurp-selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.close(),b&&b.noFocus||this.focusser.focus(),q(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2wpurp-chosen");this.selection.data("select2wpurp-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2wpurp-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2wpurp-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),void 0;if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2wpurp-data"),c==b&&(c=null),c):(arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),f=N(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2wpurp-container select2wpurp-container-multi"}).html(["<ul class='select2wpurp-choices'>","  <li class='select2wpurp-search-field'>","    <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2wpurp-input'>","  </li>","</ul>","<div class='select2wpurp-drop select2wpurp-drop-multi select2wpurp-display-none'>","   <ul class='select2wpurp-results'>","   </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=r(c.val(),b.separator),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return q(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c<e.length;c++)for(var g=e[c],h=0;h<f.length;h++){var i=f[h];if(q(g,b.id(i))){a.push(i),f.splice(h,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2wpurp-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2wpurp-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2wpurp-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},destroy:function(){a("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments)},initContainer:function(){var d,b=".select2wpurp-choices";this.searchContainer=this.container.find(".select2wpurp-search-field"),this.selection=d=this.container.find(b);var e=this;this.selection.on("click",".select2wpurp-search-choice:not(.select2wpurp-locked)",function(){e.search[0].focus(),e.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+g()),a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var b=d.find(".select2wpurp-search-choice-focus"),e=b.prev(".select2wpurp-search-choice:not(.select2wpurp-locked)"),f=b.next(".select2wpurp-search-choice:not(.select2wpurp-locked)"),g=z(this.search);if(b.length&&(a.which==c.LEFT||a.which==c.RIGHT||a.which==c.BACKSPACE||a.which==c.DELETE||a.which==c.ENTER)){var h=b;return a.which==c.LEFT&&e.length?h=e:a.which==c.RIGHT?h=f.length?f:null:a.which===c.BACKSPACE?(this.unselect(b.first()),this.search.width(10),h=e.length?e:f):a.which==c.DELETE?(this.unselect(b.first()),this.search.width(10),h=f.length?f:null):a.which==c.ENTER&&(h=null),this.selectChoice(h),A(a),h&&h.length||this.open(),void 0}if((a.which===c.BACKSPACE&&1==this.keydowns||a.which==c.LEFT)&&0==g.offset&&!g.length)return this.selectChoice(d.find(".select2wpurp-search-choice:not(.select2wpurp-locked)").last()),A(a),void 0;if(this.selectChoice(null),this.opened())switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),this.close(),void 0;case c.ESC:return this.cancel(a),A(a),void 0}if(a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.BACKSPACE&&a.which!==c.ESC){if(a.which===c.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)&&A(a),a.which===c.ENTER&&A(a)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2wpurp-container-active"),this.search.removeClass("select2wpurp-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2wpurp-blur"))})),this.container.on("click",b,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2wpurp-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2wpurp-container-active")||this.opts.element.trigger(a.Event("select2wpurp-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2wpurp-container-active")||this.opts.element.trigger(a.Event("select2wpurp-focus")),this.container.addClass("select2wpurp-container-active"),this.dropdown.addClass("select2wpurp-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2wpurp-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2wpurp-focused")===!1?(this.search.val(a).addClass("select2wpurp-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2wpurp-default")&&this.search.val("").removeClass("select2wpurp-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),this.updateResults(!0),this.search.focus(),this.opts.element.trigger(a.Event("select2wpurp-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2wpurp-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){o(e.id(this),c)<0&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2wpurp-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,b){this.triggerSelect(a)&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()&&this.updateResults(!0),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),b&&b.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("<li class='select2wpurp-search-choice'>    <div></div>    <a href='#' onclick='return false;' class='select2wpurp-search-choice-close' tabindex='-1'></a></li>"),f=a("<li class='select2wpurp-search-choice select2wpurp-locked'><div></div></li>"),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith("<div>"+j+"</div>"),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2wpurp-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2wpurp-search-choice").fadeOut("fast",this.bind(function(){this.unselect(a(b.target)),this.selection.find(".select2wpurp-search-choice-focus").removeClass("select2wpurp-search-choice-focus"),this.close(),this.focusSearch()})).dequeue(),A(b))})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2wpurp-container-active"),this.dropdown.addClass("select2wpurp-drop-active"))})),g.data("select2wpurp-data",c),g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2wpurp-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2wpurp-search-choice";if(d=b.data("select2wpurp-data")){for(;(e=o(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();var f=a.Event("select2wpurp-removing");f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented()||(b.remove(),this.opts.element.trigger({type:"select2wpurp-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}))}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2wpurp-result"),f=this.results.find(".select2wpurp-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2wpurp-data"));o(c,d)>=0&&(b.addClass("select2wpurp-selected"),b.find(".select2wpurp-result-selectable").addClass("select2wpurp-selected"))}),f.each2(function(a,b){b.is(".select2wpurp-result-selectable")||0!==b.find(".select2wpurp-result-selectable:not(.select2wpurp-selected)").length||b.addClass("select2wpurp-selected")}),-1==this.highlight()&&c!==!1&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2wpurp-result:not(.select2wpurp-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2wpurp-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2wpurp-no-results'>"+g.opts.formatNoMatches(g.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-s(this.search)},resizeSearch:function(){var a,b,c,d,e,f=s(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),r(a,this.opts.separator))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){o(this,c)<0&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c<b.length;c++)for(var d=0;d<a.length;d++)q(this.opts.id(b[c]),this.opts.id(a[d]))&&(b.splice(c,1),c>0&&c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),void 0;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2wpurp-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2wpurp-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.find(".select2wpurp-search-choice").map(function(){return a(this).data("select2wpurp-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2wpurp=function(){var d,g,h,i,j,c=Array.prototype.slice.call(arguments,0),k=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],l=["opened","isFocused","container","dropdown"],m=["val","data"],n={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?j=d.element.prop("multiple"):(j=d.multiple||!1,"tags"in d&&(d.multiple=j=!0)),g=j?new f:new e,g.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2wpurp plugin: "+c;if(o(c[0],k)<0)throw"Unknown method: "+c[0];if(i=b,g=a(this).data("select2wpurp"),g===b)return;if(h=c[0],"container"===h?i=g.container:"dropdown"===h?i=g.dropdown:(n[h]&&(h=n[h]),i=g[h].apply(g,c.slice(1))),o(c[0],l)>=0||o(c[0],m)&&1==c.length)return!1}}),i===b?this:i},a.fn.select2wpurp.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(a.text,c.term,e,d),e.join("")},formatSelection:function(a,c,d){return a?d(a.text):b},sortResults:function(a){return a},formatResultCssClass:function(){return b},formatSelectionCssClass:function(){return b},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a.id},matcher:function(a,b){return n(""+b).toUpperCase().indexOf(n(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b}},a.fn.select2wpurp.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2wpurp={query:{ajax:G,local:H,tags:I},util:{debounce:v,markMatch:E,escapeMarkup:F,stripDiacritics:n},"class":{"abstract":d,single:e,multi:f}}}}(jQuery);jQuery(document).ready(function(){0<jQuery(".wpurp-recipe-add-to-meal-plan").length&&(jQuery(".wpurp-meal-plan-button-date").datepicker({monthNames:wpurp_meal_planner.datepicker.monthNames,monthNamesShort:wpurp_meal_planner.datepicker.monthNamesShort,dayNames:wpurp_meal_planner.datepicker.dayNames,dayNamesShort:wpurp_meal_planner.datepicker.dayNamesShort,dayNamesMin:wpurp_meal_planner.datepicker.dayNamesMin,dateFormat:wpurp_meal_planner.datepicker.dateFormat,firstDay:wpurp_meal_planner.datepicker.firstDay,
isRTL:wpurp_meal_planner.datepicker.isRTL}),jQuery(document).on("click",".wpurp-recipe-add-to-meal-plan",function(a){a.preventDefault();a.stopPropagation();jQuery(this).next().toggleClass("tooltip-force-display")}),jQuery(document).on("change",".wpurp-meal-plan-button-course",function(a){a.preventDefault();a.stopPropagation();var b=jQuery(this).parents(".recipe-tooltip-content").prev();if(!b.hasClass("in-meal-plan")){a=b.data("recipe-id");var d=b.parents(".wpurp-container"),e=0,c=d.find("input.adjust-recipe-servings");
0==c.length&&(c=d.find("input.advanced-adjust-recipe-servings"));0!=c.length&&(e=parseInt(c.val()));d=b.next().find(".wpurp-meal-plan-button-date").val();c=b.next().find(".wpurp-meal-plan-button-course option:selected").text();jQuery.post(wpurp_add_to_meal_plan.ajaxurl,{action:"meal_planner_button",security:wpurp_add_to_meal_plan.nonce,recipe_id:a,servings_wanted:e,date:d,course:c},function(a){b.addClass("in-meal-plan");b.next().removeClass("tooltip-force-display");if(b.next().hasClass("recipe-tooltip-content")){a=
b.next().find(".tooltip-shown").first();var c=b.next().find(".tooltip-alt").first(),d=a.html(),e=c.html();a.html(e);c.html(d)}})}}))});var wpurp=wpurp||{};wpurp.timer_seconds=0;wpurp.timer_seconds_remaining=0;wpurp.timer_alarm_sound="data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi9ILU5mBjFANmRwlVJ3/6jYDAmxaiDG3/6xjQQCCKkRb/6kg/wW+kSJ5//rLobkLSiKmqP/0ikJuDaSaSf/6JiLYLEYnW/+kXg1WRVJL/9EmQ1YZIsv/6Qzwy5qk7/+tEU0nkls3/zIUMPKNX/6yZLf+kFgAfgGyLFAUwY//uQZAUABcd5UiNPVXAAAApAAAAAE0VZQKw9ISAAACgAAAAAVQIygIElVrFkBS+Jhi+EAuu+lKAkYUEIsmEAEoMeDmCETMvfSHTGkF5RWH7kz/ESHWPAq/kcCRhqBtMdokPdM7vil7RG98A2sc7zO6ZvTdM7pmOUAZTnJW+NXxqmd41dqJ6mLTXxrPpnV8avaIf5SvL7pndPvPpndJR9Kuu8fePvuiuhorgWjp7Mf/PRjxcFCPDkW31srioCExivv9lcwKEaHsf/7ow2Fl1T/9RkXgEhYElAoCLFtMArxwivDJJ+bR1HTKJdlEoTELCIqgEwVGSQ+hIm0NbK8WXcTEI0UPoa2NbG4y2K00JEWbZavJXkYaqo9CRHS55FcZTjKEk3NKoCYUnSQ0rWxrZbFKbKIhOKPZe1cJKzZSaQrIyULHDZmV5K4xySsDRKWOruanGtjLJXFEmwaIbDLX0hIPBUQPVFVkQkDoUNfSoDgQGKPekoxeGzA4DUvnn4bxzcZrtJyipKfPNy5w+9lnXwgqsiyHNeSVpemw4bWb9psYeq//uQZBoABQt4yMVxYAIAAAkQoAAAHvYpL5m6AAgAACXDAAAAD59jblTirQe9upFsmZbpMudy7Lz1X1DYsxOOSWpfPqNX2WqktK0DMvuGwlbNj44TleLPQ+Gsfb+GOWOKJoIrWb3cIMeeON6lz2umTqMXV8Mj30yWPpjoSa9ujK8SyeJP5y5mOW1D6hvLepeveEAEDo0mgCRClOEgANv3B9a6fikgUSu/DmAMATrGx7nng5p5iimPNZsfQLYB2sDLIkzRKZOHGAaUyDcpFBSLG9MCQALgAIgQs2YunOszLSAyQYPVC2YdGGeHD2dTdJk1pAHGAWDjnkcLKFymS3RQZTInzySoBwMG0QueC3gMsCEYxUqlrcxK6k1LQQcsmyYeQPdC2YfuGPASCBkcVMQQqpVJshui1tkXQJQV0OXGAZMXSOEEBRirXbVRQW7ugq7IM7rPWSZyDlM3IuNEkxzCOJ0ny2ThNkyRai1b6ev//3dzNGzNb//4uAvHT5sURcZCFcuKLhOFs8mLAAEAt4UWAAIABAAAAAB4qbHo0tIjVkUU//uQZAwABfSFz3ZqQAAAAAngwAAAE1HjMp2qAAAAACZDgAAAD5UkTE1UgZEUExqYynN1qZvqIOREEFmBcJQkwdxiFtw0qEOkGYfRDifBui9MQg4QAHAqWtAWHoCxu1Yf4VfWLPIM2mHDFsbQEVGwyqQoQcwnfHeIkNt9YnkiaS1oizycqJrx4KOQjahZxWbcZgztj2c49nKmkId44S71j0c8eV9yDK6uPRzx5X18eDvjvQ6yKo9ZSS6l//8elePK/Lf//IInrOF/FvDoADYAGBMGb7FtErm5MXMlmPAJQVgWta7Zx2go+8xJ0UiCb8LHHdftWyLJE0QIAIsI+UbXu67dZMjmgDGCGl1H+vpF4NSDckSIkk7Vd+sxEhBQMRU8j/12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=";
wpurp.timer=void 0;wpurp.alarm_timer=void 0;wpurp.timer_play=function(){jQuery("#wpurp-timer-play").hide();jQuery("#wpurp-timer-pause").show();clearInterval(wpurp.timer);wpurp.timer=setInterval(wpurp.update_timer,1E3)};wpurp.timer_pause=function(){jQuery("#wpurp-timer-pause").hide();jQuery("#wpurp-timer-play").show();clearInterval(wpurp.timer)};
wpurp.update_timer=function(){wpurp.timer_seconds_remaining--;0>=wpurp.timer_seconds_remaining&&(wpurp.timer_seconds_remaining=0,wpurp.timer_finished());jQuery("#wpurp-timer-remaining").text(wpurp.timer_seconds_to_hms(wpurp.timer_seconds_remaining));var a=100*(wpurp.timer_seconds-wpurp.timer_seconds_remaining)/wpurp.timer_seconds;jQuery("#wpurp-timer-bar-elapsed").css("width",a+"%")};
wpurp.timer_finished=function(){wpurp.timer_pause();clearInterval(wpurp.alarm_timer);wpurp.timer_finished_sequence();wpurp.timer=setInterval(wpurp.timer_finished_sequence,2E3)};wpurp.timer_finished_sequence=function(){wpurp.timer_play_alarm();jQuery("#wpurp-timer-container").animate({opacity:.5},500).animate({opacity:1},500).animate({opacity:.5},500).animate({opacity:1},500)};
wpurp.timer_play_alarm=function(){var a=new Audio(wpurp.timer_alarm_sound);wpurp.alarm_timer=setInterval(function(){a.play()},250);setTimeout(function(){clearInterval(wpurp.alarm_timer)},1250)};
wpurp.open_timer=function(a){wpurp.remove_timer(function(){if(0<a){wpurp.timer_seconds=a;wpurp.timer_seconds_remaining=a;var b=jQuery('<div id="wpurp-timer-container"></div>').hide(),c=jQuery('<span id="wpurp-timer-play" class="wpurp-timer-icon">'+wpurp_timer.icons.play+"</span>"),e=jQuery('<span id="wpurp-timer-pause" class="wpurp-timer-icon">'+wpurp_timer.icons.pause+"</span>"),d=jQuery('<span id="wpurp-timer-remaining"></span>'),f=jQuery('<span id="wpurp-timer-bar-container"><span id="wpurp-timer-bar"><span id="wpurp-timer-bar-elapsed"></span></span></span>'),
g=jQuery('<span id="wpurp-timer-close" class="wpurp-timer-icon">'+wpurp_timer.icons.close+"</span>");d.text(wpurp.timer_seconds_to_hms(a));b.append(c).append(e).append(d).append(f).append(g);jQuery("body").append(b);wpurp.timer_play();b.fadeIn()}})};wpurp.remove_timer=function(a){clearInterval(wpurp.timer);clearInterval(wpurp.alarm_timer);var b=jQuery("#wpurp-timer-container");0<b.length?(b.clearQueue(),b.fadeOut(400,function(){b.remove();void 0!==a&&a()})):void 0!==a&&a()};
wpurp.timer_seconds_to_hms=function(a){var b=Math.floor(a/3600);a-=3600*b;var c=Math.floor(a/60);a-=60*c;return(10>b?"0"+b:b)+":"+(10>c?"0"+c:c)+":"+(10>a?"0"+a:a)};
jQuery(document).ready(function(a){jQuery(document).on("click",".wpurp-timer-link",function(a){a.preventDefault();a.stopPropagation();a=parseInt(jQuery(this).find(".wpurp-timer").data("seconds"));wpurp.open_timer(a)});jQuery(document).on("click","#wpurp-timer-play",function(a){wpurp.timer_play()});jQuery(document).on("click","#wpurp-timer-pause",function(a){wpurp.timer_pause()});jQuery(document).on("click","#wpurp-timer-close",function(a){wpurp.remove_timer()})});/*
 Copyright © 2006-2007 Kevin C. Olbrich
Copyright © 2010-2013 LIM SAS (http://lim.eu) - Julien Sanchez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
(function(e,p){"object"===typeof exports?module.exports=p():"function"===typeof define&&define.amd?define(p):e.Qty=p()})(this,function(){function e(a){this.signature=this.baseScalar=this.scalar=null;this.output={};this.denominator=this.numerator=l;if(a.constructor===String){var b=a=a.trim(),c=N.exec(b);if(!c)throw b+": Quantity not recognized";if(""===b.trim())throw"Unit not recognized";this.scalar=c[1]?parseFloat(c[1]):1;for(var b=c[2],d=c[3],f,e,k;c=O.exec(b);){f=parseFloat(c[2]);if(isNaN(f))throw"Unit exponent is not a number";
if(0===f&&!z.test(c[1]))throw"Unit not recognized";e=c[1]+" ";k="";for(var g=0;g<Math.abs(f);g++)k+=e;0<=f?b=b.replace(c[0],k):(d=d?d+k:k,b=b.replace(c[0],""))}for(;c=P.exec(d);){f=parseFloat(c[2]);if(isNaN(f))throw"Unit exponent is not a number";if(0===f&&!z.test(c[1]))throw"Unit not recognized";e=c[1]+" ";k="";for(g=0;g<f;g++)k+=e;d=d.replace(c[0],k,"g")}b&&(this.numerator=D(b.trim()));d&&(this.denominator=D(d.trim()))}else this.scalar=a.scalar,this.numerator=a.numerator&&0!==a.numerator.length?
a.numerator:l,this.denominator=a.denominator&&0!==a.denominator.length?a.denominator:l;if(0<=this.denominator.join("*").indexOf("temp"))throw"Cannot divide with temperatures";if(0<=this.numerator.join("*").indexOf("temp")){if(1<this.numerator.length)throw"Cannot multiply by temperatures";if(!r(this.denominator,l))throw"Cannot divide with temperatures";}this.initValue=a;this.baseScalar||(this.isBase()?(this.baseScalar=this.scalar,this.signature=Q.call(this)):(a=this.toBase(),this.baseScalar=a.scalar,
this.signature=a.signature));if(this.isTemperature()&&0>this.baseScalar)throw"Temperatures must not be less than absolute zero";}function p(){throw"Incompatible units";}function R(a,b){for(var c=[],d=[],f=1,h,k=0;k<a.length;k++)h=a[k],q[h]?f=u(f,q[h]):g[h]&&(f*=g[h].scalar,g[h].numerator&&c.push(g[h].numerator),g[h].denominator&&d.push(g[h].denominator));for(k=0;k<b.length;k++)h=b[k],q[h]?f/=q[h]:g[h]&&(f/=g[h].scalar,g[h].numerator&&d.push(g[h].numerator),g[h].denominator&&c.push(g[h].denominator));
c=c.reduce(function(a,b){return a.concat(b)},[]);d=d.reduce(function(a,b){return a.concat(b)},[]);return new e({scalar:f,numerator:c,denominator:d})}function D(a){var b=E[a];if(b)return b;var c=[];if(!z.test(a))throw"Unit not recognized";for(;b=S.exec(a);)c.push(b.slice(1));c=c.map(function(a){return w[a[0]]?[w[a[0]],x[a[1]]]:[x[a[1]]]});c=c.reduce(function(a,b){return a.concat(b)},[]);c=c.filter(function(a){return a});return E[a]=c}function A(){}function F(a){var b=G.get(a);if(b)return b;b=r(a,l)?
"1":T(U(a)).join("*");G.set(a,b);return b}function U(a){for(var b=[],c,d,f=0;f<a.length;f++)c=a[f],d=a[f+1],q[c]?(b.push(y[c]+y[d]),f++):b.push(y[c]);return b}function T(a){return a.reduce(function(a,c){var b=a[c];b||a.push(b=a[c]=[c,0]);b[1]++;return a},[]).map(function(a){return a[0]+(1<a[1]?a[1]:"")})}function r(a,b){if(b.length!==a.length)return!1;for(var c=0;c<a.length;c++)if(b[c].compareArray&&!b[c].compareArray(a[c])||b[c]!==a[c])return!1;return!0}function H(a,b){var c=b.to(B(a.units()));return new e({scalar:a.scalar+
c.scalar,numerator:a.numerator,denominator:a.denominator})}function B(a){if("tempK"===a)return"degK";if("tempC"===a)return"degC";if("tempF"===a)return"degF";if("tempR"===a)return"degR";throw"Unknown type for temp conversion from: "+a;}function u(){for(var a=1,b=0,c=0;c<arguments.length;c++)var d=arguments[c],b=b+I(d),a=a*d;return 0!==b?Math.round(a*Math.pow(10,b))/Math.pow(10,b):a}function J(a,b){if(0===b)throw"Divide by zero";var c=Math.pow(10,I(b));return u(a,c/(c*b))}function I(a){var b;if((b=
V.exec(a))&&b[2])var c=b[2].length;else if(b=W.exec(a))c=parseInt(b[2],10);return c||0}function K(a,b){a=a.filter(function(a){return"<1>"!==a});b=b.filter(function(a){return"<1>"!==a});for(var c={},d,f=0;f<a.length;f++)q[a[f]]?(d=[a[f],a[f+1]],f++):d=a[f],d&&"<1>"!==d&&(c[d]?c[d][0]++:c[d]=[1,d]);for(f=0;f<b.length;f++)q[b[f]]?(d=[b[f],b[f+1]],f++):d=b[f],d&&"<1>"!==d&&(c[d]?c[d][0]--:c[d]=[-1,d]);a=[];b=[];for(var e in c)if(c.hasOwnProperty(e))if(d=c[e],0<d[0])for(f=0;f<d[0];f++)a.push(d[1]);else if(0>
d[0])for(f=0;f<-d[0];f++)b.push(d[1]);0===a.length&&(a=l);0===b.length&&(b=l);a=a.reduce(function(a,b){return a.concat(b)},[]);b=b.reduce(function(a,b){return a.concat(b)},[]);return[a,b]}function X(a){return a}var v={"<googol>":[["googol"],1E100,"prefix"],"<kibi>":[["Ki","Kibi","kibi"],Math.pow(2,10),"prefix"],"<mebi>":[["Mi","Mebi","mebi"],Math.pow(2,20),"prefix"],"<gibi>":[["Gi","Gibi","gibi"],Math.pow(2,30),"prefix"],"<tebi>":[["Ti","Tebi","tebi"],Math.pow(2,40),"prefix"],"<pebi>":[["Pi","Pebi",
"pebi"],Math.pow(2,50),"prefix"],"<exi>":[["Ei","Exi","exi"],Math.pow(2,60),"prefix"],"<zebi>":[["Zi","Zebi","zebi"],Math.pow(2,70),"prefix"],"<yebi>":[["Yi","Yebi","yebi"],Math.pow(2,80),"prefix"],"<yotta>":[["Y","Yotta","yotta"],1E24,"prefix"],"<zetta>":[["Z","Zetta","zetta"],1E21,"prefix"],"<exa>":[["E","Exa","exa"],1E18,"prefix"],"<peta>":[["P","Peta","peta"],1E15,"prefix"],"<tera>":[["T","Tera","tera"],1E12,"prefix"],"<giga>":[["G","Giga","giga"],1E9,"prefix"],"<mega>":[["M","Mega","mega"],1E6,
"prefix"],"<kilo>":[["k","kilo"],1E3,"prefix"],"<hecto>":[["h","Hecto","hecto"],100,"prefix"],"<deca>":[["da","Deca","deca","deka"],10,"prefix"],"<deci>":[["d","Deci","deci"],.1,"prefix"],"<centi>":[["c","Centi","centi"],.01,"prefix"],"<milli>":[["m","Milli","milli"],.001,"prefix"],"<micro>":[["u","Micro","micro"],1E-6,"prefix"],"<nano>":[["n","Nano","nano"],1E-9,"prefix"],"<pico>":[["p","Pico","pico"],1E-12,"prefix"],"<femto>":[["f","Femto","femto"],1E-15,"prefix"],"<atto>":[["a","Atto","atto"],
1E-18,"prefix"],"<zepto>":[["z","Zepto","zepto"],1E-21,"prefix"],"<yocto>":[["y","Yocto","yocto"],1E-24,"prefix"],"<1>":[["1","<1>"],1,""],"<meter>":[["m","meter","meters","metre","metres"],1,"length",["<meter>"]],"<inch>":[["in","inch","inches",'"'],.0254,"length",["<meter>"]],"<foot>":[["ft","foot","feet","'"],.3048,"length",["<meter>"]],"<yard>":[["yd","yard","yards"],.9144,"length",["<meter>"]],"<mile>":[["mi","mile","miles"],1609.344,"length",["<meter>"]],"<naut-mile>":[["nmi"],1852,"length",
["<meter>"]],"<league>":[["league","leagues"],4828,"length",["<meter>"]],"<furlong>":[["furlong","furlongs"],201.2,"length",["<meter>"]],"<rod>":[["rd","rod","rods"],5.029,"length",["<meter>"]],"<mil>":[["mil","mils"],2.54E-5,"length",["<meter>"]],"<angstrom>":[["ang","angstrom","angstroms"],1E-10,"length",["<meter>"]],"<fathom>":[["fathom","fathoms"],1.829,"length",["<meter>"]],"<pica>":[["pica","picas"],.004217,"length",["<meter>"]],"<point>":[["pt","point","points"],3.514E-4,"length",["<meter>"]],
"<redshift>":[["z","red-shift"],1.302773E26,"length",["<meter>"]],"<AU>":[["AU","astronomical-unit"],1495979E5,"length",["<meter>"]],"<light-second>":[["ls","light-second"],299792500,"length",["<meter>"]],"<light-minute>":[["lmin","light-minute"],1798755E4,"length",["<meter>"]],"<light-year>":[["ly","light-year"],9460528E9,"length",["<meter>"]],"<parsec>":[["pc","parsec","parsecs"],3085678E10,"length",["<meter>"]],"<kilogram>":[["kg","kilogram","kilograms"],1,"mass",["<kilogram>"]],"<AMU>":[["u",
"AMU","amu"],6.0221415E26,"mass",["<kilogram>"]],"<dalton>":[["Da","Dalton","Daltons","dalton","daltons"],6.0221415E26,"mass",["<kilogram>"]],"<slug>":[["slug","slugs"],14.5939029,"mass",["<kilogram>"]],"<short-ton>":[["tn","ton"],907.18474,"mass",["<kilogram>"]],"<metric-ton>":[["tonne"],1E3,"mass",["<kilogram>"]],"<carat>":[["ct","carat","carats"],2E-4,"mass",["<kilogram>"]],"<pound>":[["lbs","lb","pound","pounds","#"],.45359237,"mass",["<kilogram>"]],"<ounce>":[["oz","ounce","ounces"],.0283495231,
"mass",["<kilogram>"]],"<gram>":[["g","gram","grams","gramme","grammes"],.001,"mass",["<kilogram>"]],"<grain>":[["grain","grains","gr"],6.479891E-5,"mass",["<kilogram>"]],"<dram>":[["dram","drams","dr"],.0017718452,"mass",["<kilogram>"]],"<stone>":[["stone","stones","st"],6.35029318,"mass",["<kilogram>"]],"<hectare>":[["hectare"],1E4,"area",["<meter>","<meter>"]],"<acre>":[["acre","acres"],4046.85642,"area",["<meter>","<meter>"]],"<sqft>":[["sqft"],1,"area",["<feet>","<feet>"]],"<liter>":["l L liter liters litre litres".split(" "),
.001,"volume",["<meter>","<meter>","<meter>"]],"<gallon>":[["gal","gallon","gallons"],.0037854118,"volume",["<meter>","<meter>","<meter>"]],"<quart>":[["qt","quart","quarts"],9.4635295E-4,"volume",["<meter>","<meter>","<meter>"]],"<pint>":[["pt","pint","pints"],4.73176475E-4,"volume",["<meter>","<meter>","<meter>"]],"<cup>":[["cu","cup","cups"],2.36588238E-4,"volume",["<meter>","<meter>","<meter>"]],"<fluid-ounce>":[["floz","fluid-ounce"],2.95735297E-5,"volume",["<meter>","<meter>","<meter>"]],"<tablespoon>":[["tbs",
"tablespoon","tablespoons"],1.47867648E-5,"volume",["<meter>","<meter>","<meter>"]],"<teaspoon>":[["tsp","teaspoon","teaspoons"],4.92892161E-6,"volume",["<meter>","<meter>","<meter>"]],"<kph>":[["kph"],.277777778,"speed",["<meter>"],["<second>"]],"<mph>":[["mph"],.44704,"speed",["<meter>"],["<second>"]],"<knot>":[["kt","kn","kts","knot","knots"],.514444444,"speed",["<meter>"],["<second>"]],"<fps>":[["fps"],.3048,"speed",["<meter>"],["<second>"]],"<gee>":[["gee"],9.80665,"acceleration",["<meter>"],
["<second>","<second>"]],"<kelvin>":[["degK","kelvin"],1,"temperature",["<kelvin>"]],"<celsius>":[["degC","celsius","celsius","centigrade"],1,"temperature",["<kelvin>"]],"<fahrenheit>":[["degF","fahrenheit"],5/9,"temperature",["<kelvin>"]],"<rankine>":[["degR","rankine"],5/9,"temperature",["<kelvin>"]],"<temp-K>":[["tempK"],1,"temperature",["<temp-K>"]],"<temp-C>":[["tempC"],1,"temperature",["<temp-K>"]],"<temp-F>":[["tempF"],5/9,"temperature",["<temp-K>"]],"<temp-R>":[["tempR"],5/9,"temperature",
["<temp-K>"]],"<second>":[["s","sec","second","seconds"],1,"time",["<second>"]],"<minute>":[["min","minute","minutes"],60,"time",["<second>"]],"<hour>":[["h","hr","hrs","hour","hours"],3600,"time",["<second>"]],"<day>":[["d","day","days"],86400,"time",["<second>"]],"<week>":[["wk","week","weeks"],604800,"time",["<second>"]],"<fortnight>":[["fortnight","fortnights"],1209600,"time",["<second>"]],"<year>":[["y","yr","year","years","annum"],31556926,"time",["<second>"]],"<decade>":[["decade","decades"],
315569260,"time",["<second>"]],"<century>":[["century","centuries"],3155692600,"time",["<second>"]],"<pascal>":[["Pa","pascal","Pascal"],1,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<bar>":[["bar","bars"],1E5,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<mmHg>":[["mmHg"],133.322368,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<inHg>":[["inHg"],3386.3881472,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<torr>":[["torr"],133.322368,
"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<atm>":[["atm","ATM","atmosphere","atmospheres"],101325,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<psi>":[["psi"],6894.76,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<cmh2o>":[["cmH2O"],98.0638,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<inh2o>":[["inH2O"],249.082052,"pressure",["<kilogram>"],["<meter>","<second>","<second>"]],"<poise>":[["P","poise"],.1,"viscosity",["<kilogram>"],
["<meter>","<second>"]],"<stokes>":[["St","stokes"],1E-4,"viscosity",["<meter>","<meter>"],["<second>"]],"<mole>":[["mol","mole"],1,"substance",["<mole>"]],"<molar>":[["M","molar"],1E3,"concentration",["<mole>"],["<meter>","<meter>","<meter>"]],"<wtpercent>":[["wt%","wtpercent"],10,"concentration",["<kilogram>"],["<meter>","<meter>","<meter>"]],"<katal>":[["kat","katal","Katal"],1,"activity",["<mole>"],["<second>"]],"<unit>":[["U","enzUnit"],1.6667E-15,"activity",["<mole>"],["<second>"]],"<farad>":[["F",
"farad","Farad"],1,"capacitance",["<farad>"]],"<coulomb>":[["C","coulomb","Coulomb"],1,"charge",["<ampere>","<second>"]],"<ampere>":[["A","Ampere","ampere","amp","amps"],1,"current",["<ampere>"]],"<siemens>":[["S","Siemens","siemens"],1,"conductance",["<second>","<second>","<second>","<ampere>","<ampere>"],["<kilogram>","<meter>","<meter>"]],"<henry>":[["H","Henry","henry"],1,"inductance",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<ampere>","<ampere>"]],"<volt>":[["V","Volt","volt",
"volts"],1,"potential",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<second>","<ampere>"]],"<ohm>":[["Ohm","ohm"],1,"resistance",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<second>","<ampere>","<ampere>"]],"<weber>":[["Wb","weber","webers"],1,"magnetism",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<ampere>"]],"<tesla>":[["T","tesla","teslas"],1,"magnetism",["<kilogram>"],["<second>","<second>","<ampere>"]],"<gauss>":[["G","gauss"],1E-4,"magnetism",["<kilogram>"],
["<second>","<second>","<ampere>"]],"<maxwell>":[["Mx","maxwell","maxwells"],1E-8,"magnetism",["<meter>","<meter>","<kilogram>"],["<second>","<second>","<ampere>"]],"<oersted>":[["Oe","oersted","oersteds"],250/Math.PI,"magnetism",["<ampere>"],["<meter>"]],"<joule>":[["J","joule","Joule","joules"],1,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<erg>":[["erg","ergs"],1E-7,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<btu>":[["BTU","btu","BTUs"],1055.056,
"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<calorie>":[["cal","calorie","calories"],4.184,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<Calorie>":[["Cal","Calorie","Calories"],4184,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<therm-US>":[["th","therm","therms","Therm"],105480400,"energy",["<meter>","<meter>","<kilogram>"],["<second>","<second>"]],"<newton>":[["N","Newton","newton"],1,"force",["<kilogram>","<meter>"],["<second>",
"<second>"]],"<dyne>":[["dyn","dyne"],1E-5,"force",["<kilogram>","<meter>"],["<second>","<second>"]],"<pound-force>":[["lbf","pound-force"],4.448222,"force",["<kilogram>","<meter>"],["<second>","<second>"]],"<hertz>":[["Hz","hertz","Hertz"],1,"frequency",["<1>"],["<second>"]],"<radian>":[["rad","radian","radian"],1,"angle",["<radian>"]],"<degree>":[["deg","degree","degrees"],Math.PI/180,"angle",["<radian>"]],"<grad>":[["grad","gradian","grads"],Math.PI/200,"angle",["<radian>"]],"<steradian>":[["sr",
"steradian","steradians"],1,"solid_angle",["<steradian>"]],"<rotation>":[["rotation"],2*Math.PI,"angle",["<radian>"]],"<rpm>":[["rpm"],2*Math.PI/60,"angular_velocity",["<radian>"],["<second>"]],"<byte>":[["B","byte"],1,"memory",["<byte>"]],"<bit>":[["b","bit"],.125,"memory",["<byte>"]],"<dollar>":[["USD","dollar"],1,"currency",["<dollar>"]],"<cents>":[["cents"],.01,"currency",["<dollar>"]],"<candela>":[["cd","candela"],1,"luminosity",["<candela>"]],"<lumen>":[["lm","lumen"],1,"luminous_power",["<candela>",
"<steradian>"]],"<lux>":[["lux"],1,"illuminance",["<candela>","<steradian>"],["<meter>","<meter>"]],"<watt>":[["W","watt","watts"],1,"power",["<kilogram>","<meter>","<meter>"],["<second>","<second>","<second>"]],"<horsepower>":[["hp","horsepower"],745.699872,"power",["<kilogram>","<meter>","<meter>"],["<second>","<second>","<second>"]],"<gray>":[["Gy","gray","grays"],1,"radiation",["<meter>","<meter>"],["<second>","<second>"]],"<roentgen>":[["R","roentgen"],.00933,"radiation",["<meter>","<meter>"],
["<second>","<second>"]],"<sievert>":[["Sv","sievert","sieverts"],1,"radiation",["<meter>","<meter>"],["<second>","<second>"]],"<becquerel>":[["Bq","bequerel","bequerels"],1,"radiation",["<1>"],["<second>"]],"<curie>":[["Ci","curie","curies"],37E9,"radiation",["<1>"],["<second>"]],"<cpm>":[["cpm"],1/60,"rate",["<count>"],["<second>"]],"<dpm>":[["dpm"],1/60,"rate",["<count>"],["<second>"]],"<bpm>":[["bpm"],1/60,"rate",["<count>"],["<second>"]],"<dot>":[["dot","dots"],1,"resolution",["<each>"]],"<pixel>":[["pixel",
"px"],1,"resolution",["<each>"]],"<ppi>":[["ppi"],1,"resolution",["<pixel>"],["<inch>"]],"<dpi>":[["dpi"],1,"typography",["<dot>"],["<inch>"]],"<cell>":[["cells","cell"],1,"counting",["<each>"]],"<each>":[["each"],1,"counting",["<each>"]],"<count>":[["count"],1,"counting",["<each>"]],"<base-pair>":[["bp"],1,"counting",["<each>"]],"<nucleotide>":[["nt"],1,"counting",["<each>"]],"<molecule>":[["molecule","molecules"],1,"counting",["<1>"]],"<dozen>":[["doz","dz","dozen"],12,"prefix_only",["<each>"]],
"<percent>":[["%","percent"],.01,"prefix_only",["<1>"]],"<ppm>":[["ppm"],1E-6,"prefix_only",["<1>"]],"<ppt>":[["ppt"],1E-9,"prefix_only",["<1>"]],"<gross>":[["gr","gross"],144,"prefix_only",["<dozen>","<dozen>"]],"<decibel>":[["dB","decibel","decibels"],1,"logarithmic",["<decibel>"]]},Y="<meter> <kilogram> <second> <mole> <farad> <ampere> <radian> <kelvin> <temp-K> <byte> <dollar> <candela> <each> <steradian> <decibel>".split(" "),l=["<1>"],N=/^([+-]?\d*(?:\.\d+)?(?:[Ee][+-]?\d+)?)\s*([^/]*)(?:\/(.+))?$/,
O=/([^ \*]+?)(?:\^|\*{2})?(-?\d+)/,P=/([^ \*]+?)(?:\^|\*{2})?(\d+)/,C="length time temperature mass current substance luminosity currency memory angle capacitance".split(" "),Z={"-312058":"resistance","-312038":"inductance","-152040":"magnetism","-152038":"magnetism","-152058":"potential","-39":"acceleration","-38":"radiation","-20":"frequency","-19":"speed","-18":"viscosity",0:"unitless",1:"length",2:"area",3:"volume",20:"time",400:"temperature",7942:"power",7959:"pressure",7962:"energy",7979:"viscosity",
7981:"force",7997:"mass_concentration",8E3:"mass",159999:"magnetism",16E4:"current",160020:"charge",312058:"conductance",3199980:"activity",3199997:"molar_concentration",32E5:"substance",63999998:"illuminance",64E6:"luminous_power",128E7:"currency",256E8:"memory",511999999980:"angular_velocity",512E9:"angle",1024E10:"capacitance"},L={};e.parse=function(a){if("string"!==typeof a&&!(a instanceof String))throw"Argument should be a string";try{return new e(a)}catch(b){return null}};e.swiftConverter=function(a,
b){var c=new e(a),d=new e(b);return c.eq(d)?X:c.isTemperature()?function(a){return c.mul(a).to(d).scalar}:function(a){return a*c.baseScalar/d.baseScalar}};var Q=function(){if(this.signature)return this.signature;for(var a=M.call(this),b=0;b<a.length;b++)a[b]*=Math.pow(20,b);return a.reduce(function(a,b){return a+b},0)},M=function(){if(!this.isBase())return M.call(this.toBase());for(var a=Array(C.length),b=0;b<a.length;b++)a[b]=0;for(var c=0;c<this.numerator.length;c++)if(b=v[this.numerator[c]])b=
C.indexOf(b[2]),0<=b&&(a[b]+=1);for(c=0;c<this.denominator.length;c++)if(b=v[this.denominator[c]])b=C.indexOf(b[2]),0<=b&&--a[b];return a};e.prototype={constructor:e,toFloat:function(){if(this.isUnitless())return this.scalar;throw"Can't convert to Float unless unitless.  Use Unit#scalar";},isUnitless:function(){return r(this.numerator,l)&&r(this.denominator,l)},isCompatible:function(a){return a&&a.constructor===String?this.isCompatible(new e(a)):a instanceof e?void 0!==a.signature?this.signature===
a.signature:!1:!1},isInverse:function(a){return this.inverse().isCompatible(a)},kind:function(){return Z[this.signature.toString()]},isBase:function(){if(void 0!==this._isBase)return this._isBase;if(this.isDegrees()&&this.numerator[0].match(/<(kelvin|temp-K)>/))return this._isBase=!0;this.numerator.concat(this.denominator).forEach(function(a){"<1>"!==a&&-1===Y.indexOf(a)&&(this._isBase=!1)},this);return!1===this._isBase?this._isBase:this._isBase=!0},toBase:function(){if(this.isBase())return this;
if(this.isTemperature()){var a=this.units();if(a.match(/(deg)[CFRK]/))a=this.baseScalar;else if("tempK"===a)a=this.scalar;else if("tempC"===a)a=this.scalar+273.15;else if("tempF"===a)a=5*(this.scalar+459.67)/9;else if("tempR"===a)a=5*this.scalar/9;else throw"Unknown type for temp conversion from: "+a;return new e({scalar:a,numerator:["<temp-K>"],denominator:l})}a=L[this.units()];a||(a=R(this.numerator,this.denominator),L[this.units()]=a);return a.mul(this.scalar)},units:function(){if(void 0!==this._units)return this._units;
var a=r(this.numerator,l),b=r(this.denominator,l);if(a&&b)return this._units="";var a=F(this.numerator),c=F(this.denominator);return this._units=a+(b?"":"/"+c)},eq:function(a){return 0===this.compareTo(a)},lt:function(a){return-1===this.compareTo(a)},lte:function(a){return this.eq(a)||this.lt(a)},gt:function(a){return 1===this.compareTo(a)},gte:function(a){return this.eq(a)||this.gt(a)},toPrec:function(a){a&&a.constructor===String&&(a=new e(a));"number"===typeof a&&(a=new e(a+" "+this.units()));this.isUnitless()?
a.isUnitless()||p():a=a.to(this.units());if(0===a.scalar)throw"Divide by zero";a=u(Math.round(this.scalar/a.scalar),a.scalar);return new e(a+this.units())},toString:function(a,b){if("number"===typeof a)b=a;else if("string"===typeof a)var c=a;else if(a instanceof e)return this.toPrec(a).toString(b);if(!b&&this.output[c])var d=this.output[c];else c?(d=this.to(c),this.output[c]=d):d=this;return d=((void 0!==b?Math.round(d.scalar*Math.pow(10,b))/Math.pow(10,b):d.scalar)+" "+d.units()).trim()},compareTo:function(a){if(a&&
a.constructor===String)return this.compareTo(new e(a));this.isCompatible(a)||p();if(this.baseScalar<a.baseScalar)return-1;if(this.baseScalar===a.baseScalar)return 0;if(this.baseScalar>a.baseScalar)return 1},same:function(a){return this.scalar===a.scalar&&this.units()===a.units()},inverse:function(){if(this.isTemperature())throw"Cannot divide with temperatures";if(0===this.scalar)throw"Divide by zero";return new e({scalar:1/this.scalar,numerator:this.denominator,denominator:this.numerator})},isDegrees:function(){return(null===
this.signature||400===this.signature)&&1===this.numerator.length&&r(this.denominator,l)&&(this.numerator[0].match(/<temp-[CFRK]>/)||this.numerator[0].match(/<(kelvin|celsius|rankine|fahrenheit)>/))},isTemperature:function(){return this.isDegrees()&&this.numerator[0].match(/<temp-[CFRK]>/)},to:function(a){if(a&&a.constructor!==String)return this.to(a.units());var b=new e(a);if(b.units()===this.units())return this;if(!this.isCompatible(b)){if(this.isInverse(b))return this.inverse().to(a);p()}if(b.isTemperature()){a=
b.units();if("tempK"===a)a=this.baseScalar;else if("tempC"===a)a=this.baseScalar-273.15;else if("tempF"===a)a=9*this.baseScalar/5-459.67;else if("tempR"===a)a=9*this.baseScalar/5;else throw"Unknown type for temp conversion to: "+a;return new e({scalar:a,numerator:b.numerator,denominator:b.denominator})}if(b.isDegrees()){a=this.units();if(a.match(/(deg)[CFRK]/))a=this.baseScalar;else if("tempK"===a)a=this.scalar;else if("tempC"===a)a=this.scalar;else if("tempF"===a)a=5*this.scalar/9;else if("tempR"===
a)a=5*this.scalar/9;else throw"Unknown type for temp conversion from: "+a;a=new e({scalar:a,numerator:["<kelvin>"],denominator:l});var c=b.units();if("degK"===c)a=a.scalar;else if("degC"===c)a=a.scalar;else if("degF"===c)a=9*a.scalar/5;else if("degR"===c)a=9*a.scalar/5;else throw"Unknown type for degree conversion to: "+c;return new e({scalar:a,numerator:b.numerator,denominator:b.denominator})}a=J(this.baseScalar,b.baseScalar);return new e({scalar:a,numerator:b.numerator,denominator:b.denominator})},
add:function(a){a&&a.constructor===String&&(a=new e(a));this.isCompatible(a)||p();if(this.isTemperature()&&a.isTemperature())throw"Cannot add two temperatures";return this.isTemperature()?H(this,a):a.isTemperature()?H(a,this):new e({scalar:this.scalar+a.to(this).scalar,numerator:this.numerator,denominator:this.denominator})},sub:function(a){a&&a.constructor===String&&(a=new e(a));this.isCompatible(a)||p();if(this.isTemperature()&&a.isTemperature()){var b=a;a=this.units();b=b.to(a);a=new e(B(a));return new e({scalar:this.scalar-
b.scalar,numerator:a.numerator,denominator:a.denominator})}if(this.isTemperature())return a=a.to(B(this.units())),new e({scalar:this.scalar-a.scalar,numerator:this.numerator,denominator:this.denominator});if(a.isTemperature())throw"Cannot subtract a temperature from a differential degree unit";return new e({scalar:this.scalar-a.to(this).scalar,numerator:this.numerator,denominator:this.denominator})},mul:function(a){if("number"===typeof a)return new e({scalar:u(this.scalar,a),numerator:this.numerator,
denominator:this.denominator});a&&a.constructor===String&&(a=new e(a));if((this.isTemperature()||a.isTemperature())&&!this.isUnitless()&&!a.isUnitless())throw"Cannot multiply by temperatures";this.isCompatible(a)&&400!==this.signature&&(a=a.to(this));var b=K(this.numerator.concat(a.numerator),this.denominator.concat(a.denominator));return new e({scalar:u(this.scalar,a.scalar),numerator:b[0],denominator:b[1]})},div:function(a){if("number"===typeof a){if(0===a)throw"Divide by zero";return new e({scalar:this.scalar/
a,numerator:this.numerator,denominator:this.denominator})}a&&a.constructor===String&&(a=new e(a));if(0===a.scalar)throw"Divide by zero";if(a.isTemperature())throw"Cannot divide with temperatures";if(this.isTemperature()&&!a.isUnitless())throw"Cannot divide with temperatures";this.isCompatible(a)&&400!==this.signature&&(a=a.to(this));var b=K(this.numerator.concat(a.denominator),this.denominator.concat(a.numerator));return new e({scalar:this.scalar/a.scalar,numerator:b[0],denominator:b[1]})}};var E=
{};A.prototype.get=function(a){1<arguments.length&&(a=Array.apply(null,arguments));return a.reduce(function(b,c,d){if(b)return b=b[c],d===a.length-1?b?b.data:void 0:b},this)};A.prototype.set=function(a,b){2<arguments.length&&(a=Array.prototype.slice.call(arguments,0,-1),b=arguments[arguments.length-1]);return a.reduce(function(c,d,e){var f=c[d];void 0===f&&(f=c[d]={});return e===a.length-1?f.data=b:f},this)};var G=new A,V=/^-?(\d+)(?:\.(\d+))?$/,W=/^-?(\d+)e-?(\d+)$/;e.mul_safe=u;e.div_safe=J;var q=
{},w={},g={},x={},y={};for(m in v)if(v.hasOwnProperty(m)){var n=v[m];if("prefix"===n[2]){q[m]=n[1];for(var t=0;t<n[0].length;t++)w[n[0][t]]=m}else for(g[m]={scalar:n[1],numerator:n[3],denominator:n[4]},t=0;t<n[0].length;t++)x[n[0][t]]=m;y[m]=n[0][0]}var m=Object.keys(w).sort(function(a,b){return b.length-a.length}).join("|");n=Object.keys(x).sort(function(a,b){return b.length-a.length}).join("|");m="("+m+")*?("+n+")\\b";var S=new RegExp(m,"g"),z=new RegExp("^\\s*("+m+"\\s*\\*?\\s*)+$");return e});var RecipeUnitConversion=RecipeUnitConversion||{};RecipeUnitConversion.getUnitFromAlias=function(a){if(null!==a&&void 0!==a)return a=a.replace(/[\(\).,\s;:=\-+]/gi,""),a=void 0!==wpurp_unit_conversion.alias_to_unit[a]?wpurp_unit_conversion.alias_to_unit[a]:wpurp_unit_conversion.alias_to_unit[a.toLowerCase()]};RecipeUnitConversion.getUnitType=function(a){return wpurp_unit_conversion.unit_to_type[a]};
RecipeUnitConversion.getUnitSystems=function(a){var c=RecipeUnitConversion.getUnitType(a);if(!c)return[];for(var b=wpurp_unit_conversion.systems,d=[],f=0,e=b.length;f<e;f++)-1!=jQuery.inArray(a,b[f]["units_"+c])&&d.push(f);return d};RecipeUnitConversion.isUniversal=function(a){return-1!=jQuery.inArray(a,wpurp_unit_conversion.universal_units)?!0:!1};RecipeUnitConversion.getAbbreviation=function(a){var c=wpurp_unit_conversion.unit_abbreviations[a];void 0===c&&(c=a);return c};
RecipeUnitConversion.getUserAbbreviation=function(a,c){var b="plural";1==c&&(b="singular");void 0!==wpurp_unit_conversion.user_abbreviations[a]?(b=wpurp_unit_conversion.user_abbreviations[a][b],void 0===b&&(b=a)):b=a;return b};
RecipeUnitConversion.determineIngredientListSystem=function(a){for(var c=[],b=0,d=wpurp_unit_conversion.systems.length;b<d;b++)c[b]=0;a.find(".wpurp-recipe-ingredient").each(function(){for(var a=jQuery(this).find(".wpurp-recipe-ingredient-unit").text(),a=RecipeUnitConversion.getUnitFromAlias(a),a=RecipeUnitConversion.getUnitSystems(a),b=0,d=a.length;b<d;b++)c[a[b]]++});a=c[0];for(var f=0,b=1,d=c.length;b<d;b++)c[b]>a&&(f=b,a=c[b]);return f};
RecipeUnitConversion.convertUnitToSystem=function(a,c,b,d){var f=wpurp_unit_conversion.systems;if("cup"==c){b=parseFloat(f[b].cup_type);var e=(new Qty("1 cup")).to("ml").scalar;.1<Math.abs(b-e)&&(a*=b/e)}b=RecipeUnitConversion.getUnitType(c);var g=new Qty(a+" "+RecipeUnitConversion.getAbbreviation(c)),k=f[d]["units_"+b],h=[];b=0;for(var l=k.length;b<l;b++)try{var m=g.to(RecipeUnitConversion.getAbbreviation(k[b])).scalar;if("cup"==k[b]){var n=parseFloat(f[d].cup_type);e=(new Qty(n+" ml")).to("cup").scalar;
.01<Math.abs(1-e)&&(m*=1/e)}h.push({unit:k[b],amount:m})}catch(p){console.log(p)}if(0===h.length)return{unit:c,amount:a};a=h.sort(RecipeUnitConversion.compareAmounts);c=a[0].amount;d=a[0].unit;b=1;l=a.length;a:for(;b<l;b++)if(999<c||5<c&&("teaspoon"==d||"tablespoon"==d))c=a[b].amount,d=a[b].unit;else break a;return{unit:d,amount:c}};RecipeUnitConversion.compareAmounts=function(a,c){return c.amount-a.amount};
RecipeUnitConversion.formatNumber=function(a,c,b){if(c&&(c=Fraction(a.toString()).snap(),100>c.denominator))return c;if(""==a||0==a)return"";b=void 0==b?parseInt(wpurp_servings.precision):b;for(c=a.toFixed(b);0==parseFloat(c);)if(b++,c=a.toFixed(b),10<b)return"";0<b&&(a=Array(b+1).join("0"),c=c.replace(new RegExp("."+a+"$"),""));"undefined"!==typeof wpurp_servings&&(c=c.replace(".",wpurp_servings.decimal_character));return c};
RecipeUnitConversion.updateIngredients=function(a,c,b){a.find(".wpurp-recipe-ingredient").each(function(){var a=jQuery(this).find(".wpurp-recipe-ingredient-quantity"),f=jQuery(this).find(".wpurp-recipe-ingredient-unit"),e=a.data("normalized"),g=a.data("fraction"),k=f.data("original"),h=RecipeUnitConversion.getUnitFromAlias(k);if(void 0!==h&&!RecipeUnitConversion.isUniversal(h)&&e){var l=RecipeUnitConversion.getUnitSystems(h),m=RecipeUnitConversion.getUnitSystems("cup");if(-1==jQuery.inArray(b,l)||
"cup"==h&&-1!=jQuery.inArray(c,m))e=RecipeUnitConversion.convertUnitToSystem(e,h,c,b),a.text(RecipeUnitConversion.formatNumber(e.amount,g)),f.text(RecipeUnitConversion.getUserAbbreviation(e.unit,e.amount)),a.data("normalized",e.amount),f.data("original",e.unit),a=jQuery(this).find(".wpurp-recipe-ingredient-name"),RecipeUnitConversion.checkIngredientPlural(a,e.amount,k)}});a.data("system",b)};
RecipeUnitConversion.recalculate=function(a){var c=jQuery(a).parents(".wpurp-container"),b=c.find(".wpurp-recipe-ingredients"),d=parseInt(b.data("system"));a=parseInt(jQuery(a).val());d!=a&&(RecipeUnitConversion.updateIngredients(b,d,a),RecipePrintButton.update(c))};
RecipeUnitConversion.init=function(){jQuery(".wpurp-recipe-ingredients").each(function(a){a=jQuery(this);var c=RecipeUnitConversion.determineIngredientListSystem(a);a.parents(".wpurp-container").find(".adjust-recipe-unit").val(c);a.parents(".wpurp-container").data("system-original",c);a.data("system",c)})};jQuery(document).ready(function(){void 0!==window.wpurp_unit_conversion&&RecipeUnitConversion.init()});
RecipeUnitConversion.adjustServings=function(a,c,b){a.find(".wpurp-recipe-ingredient").each(function(){var a=jQuery(this).find(".wpurp-recipe-ingredient-quantity"),f=jQuery(this).find(".wpurp-recipe-ingredient-unit"),e=a.data("normalized"),g=a.data("fraction");isFinite(e)?(e=b*e/c,g=RecipeUnitConversion.formatNumber(e,g),a.text(g).data("normalized",e),a=f.data("original"),g=RecipeUnitConversion.getUnitFromAlias(a),f.text(RecipeUnitConversion.getUserAbbreviation(g,e)),f=jQuery(this).find(".wpurp-recipe-ingredient-name"),
RecipeUnitConversion.checkIngredientPlural(f,e,a)):a.addClass("recipe-ingredient-nan")})};RecipeUnitConversion.checkIngredientPlural=function(a,c,b){var d=a.data("plural");1!=c.toFixed(2)||""!=b&&void 0!=b||(d=a.data("singular"));void 0!==d&&(0<a.find("a").length?a.find("a").text(d):a.text(d))};
jQuery(document).on("keyup change",".advanced-adjust-recipe-servings",function(a){a=jQuery(this);var c=a.parents(".wpurp-container").find(".wpurp-recipe-ingredients"),b=parseFloat(a.data("original")),d=a.val();if(isNaN(d)||0>=d)d=1;RecipeUnitConversion.adjustServings(c,b,d);a.parents(".wpurp-container").find(".advanced-adjust-recipe-servings").each(function(){jQuery(this).data("original",d)});RecipePrintButton.update(a.parents(".wpurp-container"))});
jQuery(document).on("blur",".advanced-adjust-recipe-servings",function(a){a=jQuery(this);var c=a.data("original");a.parents(".wpurp-container").find(".advanced-adjust-recipe-servings").each(function(){jQuery(this).val(c)});RecipePrintButton.update(a.parents(".wpurp-container"))});var RecipeUserMenus=RecipeUserMenus||{};RecipeUserMenus.recipes=[];RecipeUserMenus.order=[];RecipeUserMenus.recipeIngredients=[];RecipeUserMenus.nbrRecipes=0;RecipeUserMenus.ajaxGettingIngredients=0;RecipeUserMenus.generalServings=4;RecipeUserMenus.menuId=0;RecipeUserMenus.unitSystem=0;
RecipeUserMenus.init=function(){RecipeUserMenus.initSelect();RecipeUserMenus.unitSystem=parseInt(wpurp_user_menus.default_system);RecipeUserMenus.changeServings(jQuery(".user-menus-servings-general"),!0);"undefined"!==typeof wpurp_user_menu&&(RecipeUserMenus.setSavedValues(wpurp_user_menu),RecipeUserMenus.redrawRecipes(),RecipeUserMenus.updateIngredients());jQuery(".user-menus-group-by").on("click",function(a){a.preventDefault();a=jQuery(this);a.hasClass("user-menus-group-by-selected")||(RecipeUserMenus.groupBy(jQuery(this).data("groupby")),
a.siblings(".user-menus-group-by-selected").removeClass("user-menus-group-by-selected"),a.addClass("user-menus-group-by-selected"))});jQuery(".user-menus-selected-recipes").sortable({opacity:.5,start:function(a,c){jQuery(".user-menus-recipes-delete").slideDown(500)},stop:function(a,c){jQuery(".user-menus-recipes-delete").slideUp(500)},update:function(a,c){RecipeUserMenus.updateRecipeOrder(jQuery(this));RecipeUserMenus.updateCookies()}});jQuery(".user-menus-servings-general").on("keyup change",function(){RecipeUserMenus.changeServings(jQuery(this),
!0)});jQuery(".user-menus-selected-recipes").on("keyup change",".user-menus-servings-recipe",function(){RecipeUserMenus.changeServings(jQuery(this),!1)});jQuery(".user-menus-servings-general").on("blur",function(){var a=jQuery(this),c=a.val();(isNaN(c)||0>=c)&&a.val(1)});jQuery(".user-menus-selected-recipes").on("blur",".user-menus-servings-recipe",function(){var a=jQuery(this),c=a.val();(isNaN(c)||0>=c)&&a.val(1)});jQuery(".wpurp-user-menus").on("click",".delete-recipe-button",function(){jQuery(this).parent(".user-menus-recipe").remove();
RecipeUserMenus.deleteRecipe()});jQuery(".user-menus-ingredients").on("change",".shopping-list-ingredient",function(){var a=jQuery(this);a.is(":checked")?a.closest("tr").addClass("ingredient-checked"):a.closest("tr").removeClass("ingredient-checked")})};RecipeUserMenus.deleteRecipe=function(){--RecipeUserMenus.nbrRecipes;RecipeUserMenus.checkIfEmpty();RecipeUserMenus.updateRecipeOrder(jQuery(".user-menus-selected-recipes"));RecipeUserMenus.updateIngredients();RecipeUserMenus.updateCookies()};
RecipeUserMenus.setSavedValues=function(a){null!==a.recipes&&(RecipeUserMenus.recipes=a.recipes,RecipeUserMenus.order=a.order);""!==a.nbrRecipes&&(RecipeUserMenus.nbrRecipes=parseInt(a.nbrRecipes));""!==a.unitSystem&&(RecipeUserMenus.unitSystem=parseInt(a.unitSystem));""!==a.menuId&&(RecipeUserMenus.menuId=parseInt(a.menuId))};
RecipeUserMenus.deleteMenu=function(){jQuery.post(wpurp_user_menus.ajaxurl,{action:"user_menus_delete",security:wpurp_user_menus.nonce,menuId:RecipeUserMenus.menuId},function(a){window.location.href=a},"html")};
RecipeUserMenus.saveMenu=function(){var a={action:"user_menus_save",security:wpurp_user_menus.nonce,menuId:RecipeUserMenus.menuId,title:jQuery(".user-menus-title").val(),recipes:RecipeUserMenus.recipes,order:RecipeUserMenus.order,nbrRecipes:RecipeUserMenus.nbrRecipes,unitSystem:RecipeUserMenus.unitSystem};jQuery.post(wpurp_user_menus.ajaxurl,a,function(a){0==RecipeUserMenus.menuId&&(window.location.href=a)},"html")};
RecipeUserMenus.printShoppingList=function(){var a=jQuery(".user-menus-title").val();wpurp_user_menus.shoppingListTitle=void 0!=a?'<h2 class="wpurp-shoppinglist-title">'+a+"</h2>":'<h2 class="wpurp-shoppinglist-title">Shopping List</h2>';wpurp_user_menus.recipeList="";wpurp_user_menus.print_recipe_list&&(console.log(wpurp_user_menus.recipes),wpurp_user_menus.recipeList='<table class="wpurp-recipelist">',wpurp_user_menus.recipeList+=wpurp_user_menus.print_recipe_list_header,jQuery(".user-menus-selected-recipes .user-menus-recipe").each(function(){wpurp_user_menus.recipeList+=
"<tr>";wpurp_user_menus.recipeList+="<td>"+jQuery(this).find("a").text()+"</td>";wpurp_user_menus.recipeList+="<td>"+jQuery(this).find("input").val()+"</td>";wpurp_user_menus.recipeList+="</tr>"}),wpurp_user_menus.recipeList+="</table>");wpurp_user_menus.shoppingList='<table class="wpurp-shoppinglist">'+jQuery(".user-menus-ingredients").html()+"</table>";window.open(wpurp_user_menus.addonUrl+"/templates/print-shopping-list.php")};
RecipeUserMenus.printUserMenu=function(){wpurp_user_menus.recipe_ids=[];wpurp_user_menus.recipes=[];wpurp_user_menus.print_servings_original=[];wpurp_user_menus.print_servings_wanted=[];wpurp_user_menus.print_unit_system=RecipeUserMenus.unitSystem;for(var a=0,c=RecipeUserMenus.order.length;a<c;a++){var b=RecipeUserMenus.recipes[RecipeUserMenus.order[a]];wpurp_user_menus.recipe_ids.push(b.id);wpurp_user_menus.print_servings_original.push(b.servings_original);wpurp_user_menus.print_servings_wanted.push(b.servings_wanted)}jQuery.post(wpurp_user_menus.ajaxurl,
{action:"get_recipe_template",security:wpurp_user_menus.nonce,recipe_ids:wpurp_user_menus.recipe_ids},function(a){wpurp_user_menus.recipes=a},"json");a=jQuery(".user-menus-title").val();wpurp_user_menus.shoppingListTitle=void 0!=a?"<h2>"+a+"</h2>":"<h2>Shopping List</h2>";wpurp_user_menus.shoppingList='<table class="wpurp-shoppinglist">'+jQuery(".user-menus-ingredients").html()+"</table>";window.open(wpurp_user_menus.addonUrl+"/templates/print-user-menu.php")};
RecipeUserMenus.updateRecipeOrder=function(a){RecipeUserMenus.order=a.sortable("toArray",{attribute:"data-index"})};RecipeUserMenus.changeServings=function(a,c){var b=a.val();if(isNaN(b)||0>=b)b=1;if(c)RecipeUserMenus.generalServings=b;else{var f=a.parent(".user-menus-recipe").data("index");RecipeUserMenus.recipes[f].servings_wanted=b;RecipeUserMenus.updateIngredientsTable();RecipeUserMenus.updateCookies()}};
RecipeUserMenus.initSelect=function(){jQuery(".user-menus-select").select2wpurp({width:"off"}).on("change",function(){RecipeUserMenus.addRecipe(jQuery(this).select2wpurp("data"));jQuery(this).select2wpurp("val","")})};
RecipeUserMenus.addRecipe=function(a){""!==a.id&&(RecipeUserMenus.recipes.push({id:a.id,name:a.text,link:a.element[0].dataset.link,servings_original:a.element[0].dataset.servings,servings_wanted:RecipeUserMenus.generalServings}),RecipeUserMenus.order.push((RecipeUserMenus.recipes.length-1).toString()),RecipeUserMenus.redrawRecipes(),RecipeUserMenus.updateCookies(),RecipeUserMenus.updateIngredients())};
RecipeUserMenus.redrawRecipes=function(){var a=jQuery(".user-menus-selected-recipes");a.empty();for(var c=RecipeUserMenus.recipes,b=RecipeUserMenus.order,f=RecipeUserMenus.nbrRecipes=0,h=b.length;f<h;f++){var n=c[b[f]];a.append('<div class="user-menus-recipe" data-recipe="'+n.id+'" data-index="'+b[f]+'"><i class="fa fa-trash delete-recipe-button"></i> <a href="'+n.link+'" target="_blank">'+n.name+'</a><input type="number" class="user-menus-servings-recipe" value="'+n.servings_wanted+'"></div>');RecipeUserMenus.nbrRecipes+=
1}RecipeUserMenus.checkIfEmpty()};RecipeUserMenus.updateCookies=function(){0==RecipeUserMenus.menuId&&jQuery.post(wpurp_user_menus.ajaxurl,{action:"update_shopping_list",security:wpurp_user_menus.nonce,recipes:RecipeUserMenus.recipes,order:RecipeUserMenus.order})};RecipeUserMenus.checkIfEmpty=function(){0===RecipeUserMenus.nbrRecipes?jQuery(".user-menus-no-recipes").show():jQuery(".user-menus-no-recipes").hide()};
RecipeUserMenus.groupBy=function(a){jQuery.post(wpurp_user_menus.ajaxurl,{action:"user_menus_groupby",security:wpurp_user_menus.nonce,groupby:a,grid:wpurp_user_menu_grid.slug},function(a){jQuery(".user-menus-select").select2wpurp("destroy").off().html(a);RecipeUserMenus.initSelect()})};
RecipeUserMenus.updateIngredients=function(){for(var a=RecipeUserMenus.order,c=RecipeUserMenus.recipes,b=0,f=0,h=a.length;f<h;f++){var n=c[a[f]].id;void 0===RecipeUserMenus.recipeIngredients[n]&&(b++,RecipeUserMenus.recipeIngredients[n]=[],RecipeUserMenus.getIngredients(n))}0===b&&RecipeUserMenus.updateIngredientsTable()};
RecipeUserMenus.getIngredients=function(a){var c={action:"user_menus_get_ingredients",security:wpurp_user_menus.nonce,recipe_id:a};RecipeUserMenus.ajaxGettingIngredients++;jQuery.post(wpurp_user_menus.ajaxurl,c,function(b){RecipeUserMenus.ajaxGettingIngredients--;RecipeUserMenus.recipeIngredients[a]=b;0===RecipeUserMenus.ajaxGettingIngredients&&RecipeUserMenus.updateIngredientsTable()},"json")};
RecipeUserMenus.updateIngredientsTable=function(){var a=jQuery("table.user-menus-ingredients");a.find("tbody").empty();for(var c=RecipeUserMenus.recipeIngredients,b=RecipeUserMenus.order,f=RecipeUserMenus.recipes,h=[],n=[],t=236.6,m=0,v=wpurp_unit_conversion.systems.length;m<v;m++){var k=wpurp_unit_conversion.systems[m];-1!=jQuery.inArray("cup",k.units_volume)&&(t=parseFloat(k.cup_type))}m=0;for(v=b.length;m<v;m++){var q=f[b[m]].id;var w=f[b[m]].servings_wanted/parseFloat(f[b[m]].servings_original);
for(var p=0,y=c[q].length;p<y;p++){var e=c[q][p];var l=wpurp_user_menus.ingredient_notes&&e.notes?e.ingredient+" ("+e.notes+")":e.ingredient;k=e.group;var u=e.plural||l;void 0===n[l]&&(n[l]=u);void 0===h[k]&&(h[k]=[]);void 0===h[k][l]&&(h[k][l]=[]);var d=e.amount_normalized*w;var g=e.unit;e=RecipeUnitConversion.getUnitFromAlias(g);if(void 0!==e&&"1"==wpurp_user_menus.consolidate_ingredients){g=RecipeUnitConversion.getAbbreviation(e);"cup"==g&&(e=(new Qty("1 cup")).to("ml").scalar,.1<Math.abs(t-e)&&
(d*=t/e));var r=new Qty(""+d+" "+g);d=r.toBase();"m3"==d.units()&&(d=d.to("l"));g=d.units();d=d.scalar}""==g&&(g="wpurp_nounit");void 0===h[k][l][g]&&(h[k][l][g]=0);h[k][l][g]+=parseFloat(d)}}c=Object.keys(h);c.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())});m=0;for(v=c.length;m<v;m++)for(p=c[m],k=h[p],p=jQuery('<tr><td colspan="2"><strong>'+p+"</strong></td></tr>"),a.append(p),b=Object.keys(k),b.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())}),
p=0,y=b.length;p<y;p++)for(g in e=b[p],f=k[e],f)if(d=f[g],isFinite(d)){t=jQuery("<tr></tr>");l=RecipeUnitConversion.getUnitFromAlias(g);w="1"==wpurp_user_menus.adjustable_system?[RecipeUserMenus.unitSystem]:wpurp_user_menus.static_systems;u=!1;for(var x=0;x<w.length;x++){q=d;r=g;"wpurp_nounit"==g?r="":void 0===l||"1"!=wpurp_user_menus.consolidate_ingredients&&(RecipeUnitConversion.isUniversal(l)||-1!=jQuery.inArray(w[x],RecipeUnitConversion.getUnitSystems(l)))||(r=RecipeUnitConversion.convertUnitToSystem(d,
l,0,w[x]),q=r.amount,r=RecipeUnitConversion.getUserAbbreviation(r.unit,q));q=RecipeUnitConversion.formatNumber(q,wpurp_user_menus.fractions);if(1<parseFloat(q)||0==parseFloat(q)||""!==r)u=!0;t.append("<td>"+q+" "+r+"</td>")}d=u?n[e]:e;d=d.charAt(0).toUpperCase()+d.slice(1);u="";"1"==wpurp_user_menus.checkboxes&&(u='<input type="checkbox" class="shopping-list-ingredient"> ');t.prepend("<td>"+u+d+"</td>");a.append(t)}};
RecipeUserMenus.changeUnits=function(a){RecipeUserMenus.unitSystem=parseInt(jQuery(a).val());RecipeUserMenus.updateIngredientsTable()};jQuery(document).ready(function(){0<jQuery(".wpurp-user-menus").length&&RecipeUserMenus.init()});jQuery(document).ready(function(){jQuery(document).on("click",".wpurp-recipe-add-to-shopping-list",function(a){a.preventDefault();a.stopPropagation();var b=jQuery(this);if(!b.hasClass("in-shopping-list")){a=b.data("recipe-id");var d=b.parents(".wpurp-container"),e=0,c=d.find("input.adjust-recipe-servings");0==c.length&&(c=d.find("input.advanced-adjust-recipe-servings"));0!=c.length&&(e=parseInt(c.val()));jQuery.post(wpurp_add_to_shopping_list.ajaxurl,{action:"add_to_shopping_list",security:wpurp_add_to_shopping_list.nonce,
recipe_id:a,servings_wanted:e},function(a){b.addClass("in-shopping-list");if(b.next().hasClass("recipe-tooltip-content")){a=b.next().find(".tooltip-shown").first();var c=b.next().find(".tooltip-alt").first(),d=a.html(),e=c.html();a.html(e);c.html(d)}})}})});jQuery(document).ready(function(){jQuery(".recipe-tooltip.vote-attention").length&&(jQuery(".recipe-tooltip.vote-attention").mouseenter(),jQuery(".vote-attention-message").show(),jQuery(".user-rating-stats").hide(),setTimeout(function(){jQuery(".recipe-tooltip.vote-attention").mouseleave();setTimeout(function(){jQuery(".vote-attention-message").hide();jQuery(".user-rating-stats").show()},500)},5E3));jQuery(document).on("mouseenter",".wpurp-container .user-star-rating.user-can-vote i",function(){var a=
jQuery(this).parents(".user-star-rating"),b=a.data("icon-full"),c=a.data("icon-half"),a=a.data("icon-empty");jQuery(this).prevAll().andSelf().removeClass(c).removeClass(a).addClass(b);jQuery(this).nextAll().removeClass(b).removeClass(c).addClass(a)});jQuery(document).on("mouseleave",".wpurp-container .user-star-rating.user-can-vote i",function(){var a=jQuery(this).parents(".user-star-rating"),b=a.data("icon-full"),c=a.data("icon-half"),a=a.data("icon-empty");jQuery(this).siblings().andSelf().removeClass(b).removeClass(c).removeClass(a).each(function(){jQuery(this).addClass(jQuery(this).data("original-icon"))})});
jQuery(document).on("click",".wpurp-container .user-star-rating.user-can-vote i",function(){var a=jQuery(this).data("star-value"),b=jQuery(this).parents(".user-star-rating"),c=b.data("recipe-id");jQuery.post(wpurp_user_ratings.ajax_url,{action:"rate_recipe",security:wpurp_user_ratings.nonce,stars:a,recipe:c},function(c){var e=b.nextAll(".recipe-tooltip-content:first"),f=b.data("icon-full"),g=b.data("icon-half"),h=b.data("icon-empty");e.find(".user-rating-votes").text(c.votes);e.find(".user-rating-rating").text(c.rating);
e.find(".user-rating-current-rating").text(a);b.find("i").each(function(a,b){var d=jQuery(b);d.removeClass(f).removeClass(g).removeClass(h);a<c.stars?d.addClass(f).data("original-icon",f):a==c.stars&&1==c.half_star?d.addClass(g).data("original-icon",g):d.addClass(h).data("original-icon",h)})},"json")})});jQuery(document).ready(function(){function n(a){if(!tinyMCE.activeEditor||tinyMCE.activeEditor.isHidden()){var b=p.val();p.val(b+a)}else tinyMCE.execCommand("mceInsertContent",!1,a)}function e(){1==jQuery(".ingredient-group").length?(jQuery("#recipe-ingredients .ingredient .ingredients_group").val(""),jQuery(".ingredient-groups-disabled").show(),jQuery(".ingredient-groups-enabled").hide()):(jQuery("#recipe-ingredients tr.ingredient").each(function(a,b){var c=jQuery(b).prevAll(".ingredient-group:first").find(".ingredient-group-label").val();
void 0===c&&(c=jQuery(".ingredient-group-first").find(".ingredient-group-label").val());jQuery(b).find(".ingredients_group").val(c)}),jQuery(".ingredient-groups-disabled").hide(),jQuery(".ingredient-groups-enabled").show())}function f(){1==jQuery(".instruction-group").length?(jQuery("#recipe-instructions .instruction .instructions_group").val(""),jQuery(".instruction-groups-disabled").show(),jQuery(".instruction-groups-enabled").hide()):(jQuery("#recipe-instructions tr.instruction").each(function(a,
b){var c=jQuery(b).prevAll(".instruction-group:first").find(".instruction-group-label").val();void 0===c&&(c=jQuery(".instruction-group-first").find(".instruction-group-label").val());jQuery(b).find(".instructions_group").val(c)}),jQuery(".instruction-groups-disabled").hide(),jQuery(".instruction-groups-enabled").show())}function q(){var a=jQuery("#recipe-ingredients tr.ingredient").length,b=jQuery("#recipe-ingredients tr:last"),c=jQuery("#recipe-ingredients tr.ingredient:last");c.find("input").attr("placeholder",
"");c=c.clone(!0);c.insertAfter(b).find("input, select").val("").attr("name",function(c,b){return b.replace(/(\d+)/,a)}).attr("id",function(c,b){return b.replace(/(\d+)/,a)}).parent().find("input.ingredients_name").attr("onfocus",function(c,b){return b.replace(/(\d+)/,a)});c.find("span.ingredients-delete").show();k();jQuery("#recipe-ingredients tr:last .ingredients_amount").focus();e()}function k(){jQuery("#recipe-ingredients .ingredients_notes").unbind("keydown").last().bind("keydown",function(a){9==
(a.keyCode||a.which)&&(a.preventDefault(),q())})}function r(){jQuery("#recipe-ingredients tr.ingredient").each(function(a){jQuery(this).find("input").attr("name",function(b,c){return c.replace(/(\d+)/,a)}).attr("id",function(b,c){return c.replace(/(\d+)/,a)}).parent().find("input.ingredients_name").attr("onfocus",function(b,c){return c.replace(/(\d+)/,a)})})}function t(){var a=jQuery("#recipe-instructions tr.instruction").length,b=jQuery("#recipe-instructions tr.instruction:last").clone(!0);b.insertAfter("#recipe-instructions tr:last").find("textarea").val("").attr("name",
function(c,b){return b.replace(/(\d+)/,a)}).attr("id",function(c,b){return b.replace(/(\d+)/,a)});b.find(".recipe_instructions_remove_image").addClass("wpurp-hide");b.find(".recipe_instructions_add_image").removeClass("wpurp-hide");b.find(".recipe_instructions_image").val("");b.find(".recipe_instructions_thumbnail").attr("src",wpurp_recipe_form.coreUrl+"/img/image_placeholder.png");b.find(".recipe_instructions_image").attr("name",function(c,b){return b.replace(/(\d+)/,a)});b.find(".instructions_group").attr("name",
function(c,b){return b.replace(/(\d+)/,a)}).attr("id",function(c,b){return b.replace(/(\d+)/,a)});b.find("span.instructions-delete").show();l();jQuery("#recipe-instructions tr:last textarea").focus();f()}function l(){jQuery("#recipe-instructions textarea").unbind("keydown").last().bind("keydown",function(a){9==(a.keyCode||a.which)&&0==a.shiftKey&&1==jQuery("#recipe-instructions tr:last").find("textarea").is(":focus")&&(a.preventDefault(),t())})}function u(){jQuery("#recipe-instructions tr.instruction").each(function(a){jQuery(this).find("textarea").attr("name",
function(b,c){return c.replace(/(\d+)/,a)}).attr("id",function(b,c){return c.replace(/(\d+)/,a)});jQuery(this).find(".recipe_instructions_image").attr("name",function(b,c){return c.replace(/(\d+)/,a)});jQuery(this).find(".instructions_group").attr("name",function(b,c){return c.replace(/(\d+)/,a)}).attr("id",function(b,c){return c.replace(/(\d+)/,a)})})}jQuery("#insert-recipe-shortcode").on("click",function(){n("[recipe]")});jQuery("#insert-nutrition-shortcode").on("click",function(){n("[nutrition-label]")});
var p=jQuery("textarea#content");jQuery("#recipe-ingredients tr.ingredient:first").find("span.ingredients-delete").hide();jQuery("#recipe-instructions tr.instruction:first").find("span.instructions-delete").hide();var g=jQuery("select#recipe_rating");if(1==g.length){for(var y=g.find("option:selected").val(),v='<img src="'+wpurp_recipe_form.coreUrl+'/img/star.png" width="15" height="14" />',m='<img src="'+wpurp_recipe_form.coreUrl+'/img/star_grey.png" width="15" height="14" />',d='<div id="recipe_rating_star_selection">',
h=1;5>=h;h++)d+='<span class="star" id="recipe-star-'+h+'" data-star="'+h+'">',d=y>=h?d+v:d+m,d+="</span>";d+="</div>";g.hide().after(d);jQuery(document).on("click","#recipe_rating_star_selection .star",function(){var a=jQuery(this);g.val()==a.data("star")?(a.siblings().andSelf().html(m),g.val(0)):(a.prevAll().andSelf().html(v),a.nextAll().html(m),g.val(a.data("star")))})}e();jQuery("#ingredients-add-group").on("click",function(a){a.preventDefault();a=jQuery("#recipe-ingredients tr.ingredient-group-stub");
var b=jQuery("#recipe-ingredients tr:last");a.clone(!0).insertAfter(b).removeClass("ingredient-group-stub").addClass("ingredient-group");jQuery(".ingredient-groups-disabled").hide();jQuery(".ingredient-groups-enabled").show();e()});var w;jQuery(".ingredient-group-label").on("input",function(){window.clearTimeout(w);w=window.setTimeout(function(){e()},500)});jQuery(".ingredient-group-delete").on("click",function(){jQuery(this).parents("tr").remove();e()});f();jQuery("#instructions-add-group").on("click",
function(a){a.preventDefault();a=jQuery("#recipe-instructions tr.instruction-group-stub");var b=jQuery("#recipe-instructions tr:last");a.clone(!0).insertAfter(b).removeClass("instruction-group-stub").addClass("instruction-group");jQuery(".instruction-groups-disabled").hide();jQuery(".instruction-groups-enabled").show();f()});var x;jQuery(".instruction-group-label").on("input",function(){window.clearTimeout(x);x=window.setTimeout(function(){f()},500)});jQuery(".instruction-group-delete").on("click",
function(){jQuery(this).parents("tr").remove();f()});jQuery("#recipe-ingredients tbody").sortable({opacity:.6,revert:!0,cursor:"move",handle:".sort-handle",update:function(){k();e();r()}});jQuery("#recipe-ingredients").on("keydown",function(a){9==(a.keyCode||a.which)&&jQuery("ul.ac_results").hide()});jQuery("#recipe-ingredients").on("click",function(){jQuery("ul.ac_results").hide()});jQuery(".ingredients-delete").on("click",function(){jQuery(this).parents("tr").remove();k();r()});jQuery("#ingredients-add").on("click",
function(a){a.preventDefault();q()});k();jQuery("#recipe-instructions tbody").sortable({opacity:.6,revert:!0,cursor:"move",handle:".sort-handle",update:function(){l();f();u()}});jQuery(".instructions-delete").on("click",function(){jQuery(this).parents("tr").remove();l();u()});jQuery("#instructions-add").on("click",function(a){a.preventDefault();t()});l();jQuery(".recipe_thumbnail_add_image").on("click",function(a){a.preventDefault();a=jQuery(this);image=a.siblings(".recipe_thumbnail_image");preview=
a.siblings(".recipe_thumbnail");if("function"==typeof wp.media)var b=wp.media({title:"Insert Media",button:{text:"Add featured image"},multiple:!1}).on("select",function(){var a=b.state().get("selection").first().toJSON();jQuery(preview).attr("src",a.url);jQuery(image).val(a.id).trigger("change")}).open();else post_id=a.attr("rel"),tb_show(a.attr("value"),"wp-admin/media-upload.php?post_id="+post_id+"&type=image&TB_iframe=1"),window.send_to_editor=function(a){img=jQuery("img",a);imgurl=img.attr("src");
classes=img.attr("class");id=classes.replace(/(.*?)wp-image-/,"");image.val(id).trigger("change");preview.attr("src",imgurl);tb_remove()}});jQuery(".recipe_thumbnail_remove_image").on("click",function(a){a.preventDefault();a=jQuery(this);a.siblings(".recipe_thumbnail_image").val("").trigger("change");a.siblings(".recipe_thumbnail").attr("src",wpurp_recipe_form.coreUrl+"/img/image_placeholder.png")});jQuery(".recipe_thumbnail_image").on("change",function(){var a=jQuery(this);""==a.val()?(a.siblings(".recipe_thumbnail_add_image").removeClass("wpurp-hide"),
a.siblings(".recipe_thumbnail_remove_image").addClass("wpurp-hide")):(a.siblings(".recipe_thumbnail_remove_image").removeClass("wpurp-hide"),a.siblings(".recipe_thumbnail_add_image").addClass("wpurp-hide"))});jQuery(".recipe_alternate_image_add").on("click",function(a){a.preventDefault();a=jQuery(this);image=a.siblings("#recipe_alternate_image");preview=a.siblings(".recipe_alternate_image");if("function"==typeof wp.media)var b=wp.media({title:"Insert Media",button:{text:"Add alternate image"},multiple:!1}).on("select",
function(){var a=b.state().get("selection").first().toJSON();jQuery(preview).attr("src",a.url);jQuery(image).val(a.id).trigger("change")}).open();else post_id=a.attr("rel"),tb_show(a.attr("value"),"wp-admin/media-upload.php?post_id="+post_id+"&type=image&TB_iframe=1"),window.send_to_editor=function(a){img=jQuery("img",a);imgurl=img.attr("src");classes=img.attr("class");id=classes.replace(/(.*?)wp-image-/,"");image.val(id).trigger("change");preview.attr("src",imgurl);tb_remove()}});jQuery(".recipe_alternate_image_remove").on("click",
function(a){a.preventDefault();a=jQuery(this);a.siblings("#recipe_alternate_image").val("").trigger("change");a.siblings(".recipe_alternate_image").attr("src",wpurp_recipe_form.coreUrl+"/img/image_placeholder.png")});jQuery("#recipe_alternate_image").on("change",function(){var a=jQuery(this);""==a.val()?(a.siblings(".recipe_alternate_image_add").removeClass("wpurp-hide"),a.siblings(".recipe_alternate_image_remove").addClass("wpurp-hide")):(a.siblings(".recipe_alternate_image_remove").removeClass("wpurp-hide"),
a.siblings(".recipe_alternate_image_add").addClass("wpurp-hide"))});jQuery(".recipe_instructions_add_image").on("click",function(a){a.preventDefault();a=jQuery(this);image=a.siblings(".recipe_instructions_image");preview=a.siblings(".recipe_instructions_thumbnail");if("function"==typeof wp.media)var b=wp.media({title:"Insert Media",button:{text:"Add instruction image"},multiple:!1}).on("select",function(){var a=b.state().get("selection").first().toJSON();jQuery(preview).attr("src",a.url);jQuery(image).val(a.id).trigger("change")}).open();
else post_id=a.attr("rel"),tb_show(a.attr("value"),"wp-admin/media-upload.php?post_id="+post_id+"&type=image&TB_iframe=1"),window.send_to_editor=function(a){img=jQuery("img",a);imgurl=img.attr("src");classes=img.attr("class");id=classes.replace(/(.*?)wp-image-/,"");image.val(id).trigger("change");preview.attr("src",imgurl);tb_remove()}});jQuery(".recipe_instructions_remove_image").on("click",function(a){a.preventDefault();a=jQuery(this);a.siblings(".recipe_instructions_image").val("").trigger("change");
a.siblings(".recipe_instructions_thumbnail").attr("src",wpurp_recipe_form.coreUrl+"/img/image_placeholder.png")});jQuery(".recipe_instructions_image").on("change",function(){var a=jQuery(this);""==a.val()?(a.siblings(".recipe_instructions_add_image").removeClass("wpurp-hide"),a.siblings(".recipe_instructions_remove_image").addClass("wpurp-hide")):(a.siblings(".recipe_instructions_remove_image").removeClass("wpurp-hide"),a.siblings(".recipe_instructions_add_image").addClass("wpurp-hide"))});jQuery("#wpurp-insert-recipe").on("click",
function(){var a="[ultimate-recipe id="+jQuery("#wpurp-recipe").find("option:selected").val();tinyMCE.activeEditor.execCommand("mceInsertContent",0,a+"]");tinyMCE.activeEditor.windowManager.close()});jQuery(".wpurp-preview-select").on("change",function(){var a=jQuery(this).siblings(".wpurp-preview-img").children("img").attr("alt");1<a.split("-").length&&(a=a.split("-")[0]+"-");var b=jQuery(this).siblings(".wpurp-preview-img").children("img").attr("src"),a=a+jQuery(this).val()+".jpg",c=b.split("/"),
c=c[c.length-1],a=b.replace(c,a);jQuery(this).siblings(".wpurp-preview-img").children("img").attr("src",a)});jQuery(".wpurp-file-upload").on("click",function(a){a.preventDefault();a=jQuery(this);preview=a.siblings("img");fieldname=preview.attr("class");image=a.siblings("."+fieldname+"_image");if("function"==typeof wp.media)var b=wp.media({title:"Insert Media",button:{text:"Add image"},multiple:!1}).on("select",function(){var a=b.state().get("selection").first().toJSON();jQuery(preview).attr("src",
a.url);jQuery(image).val(a.id)}).open();else post_id=a.attr("rel"),tb_show(a.attr("value"),"wp-admin/media-upload.php?post_id="+post_id+"&type=image&TB_iframe=1"),window.send_to_editor=function(a){img=jQuery("img",a);imgurl=img.attr("src");classes=img.attr("class");id=classes.replace(/(.*?)wp-image-/,"");image.val(id).trigger("change");preview.attr("src",imgurl);tb_remove()};a.addClass("wpurp-hide");a.siblings(".wpurp-file-remove").removeClass("wpurp-hide")});jQuery(".wpurp-file-remove").on("click",
function(a){a.preventDefault();a=jQuery(this);preview=a.siblings("img");fieldname=preview.attr("class");a.siblings("."+fieldname+"_image").val("");a.siblings("."+fieldname).attr("src","");a.siblings(".wpurp-file-upload").removeClass("wpurp-hide");a.addClass("wpurp-hide")})});jQuery(document).ready(function(){jQuery("#wpurp_user_submission_form select[multiple]").select2wpurp({allowClear:!0,width:"off",dropdownAutoWidth:!1});jQuery(".user-submissions-delete-recipe").on("click",function(){var a=jQuery(this);confirm(wpurp_user_submissions.confirm_message+" "+a.data("title"))&&(a.parent("li").remove(),a={action:"user_submissions_delete_recipe",security:wpurp_user_submissions.nonce,recipe:a.data("id")},jQuery.post(wpurp_user_submissions.ajaxurl,a))})});var RecipeMealPlanner=RecipeMealPlanner||{};RecipeMealPlanner.loader='<div class="wpurp-loader"><div></div><div></div><div></div></div>';RecipeMealPlanner.templates=[];RecipeMealPlanner.ajaxUpdateTimer=null;RecipeMealPlanner.wait_for_load=!1;
RecipeMealPlanner.init=function(){jQuery(".wpurp-meal-plan-calendar-container").each(function(){RecipeMealPlanner.updateNutritional(jQuery(this))});RecipeMealPlanner.initSelect(!0);var e=jQuery(".wpurp-meal-plan"),g=jQuery(".wpurp-meal-plan-calendar-container"),d=jQuery(".wpurp-meal-plan-shopping-list-container"),e=e.hasClass("wpurp-meal-plan-mobile");jQuery("#wpurp-meal-plan-leftovers").on("change",function(){var b=jQuery(this),a=b.is(":checked");b.parents(".wpurp-meal-plan-add-recipe-container").find(".wpurp-meal-plan-recipe").each(function(){var b=
jQuery(this),f=b.data("name");a?b.find(".wpurp-meal-plan-recipe-title").text(f+" ("+wpurp_meal_planner.textLeftovers+")"):b.find(".wpurp-meal-plan-recipe-title").text(f);b.data("leftovers",a)})});jQuery(".wpurp-meal-plan-group-by").on("click",function(b){b.preventDefault();b=jQuery(this);b.hasClass("wpurp-meal-plan-group-by-selected")||(RecipeMealPlanner.groupBy(jQuery(this).data("groupby")),b.siblings(".wpurp-meal-plan-group-by-selected").removeClass("wpurp-meal-plan-group-by-selected"),b.addClass("wpurp-meal-plan-group-by-selected"))});
g.on("click",".wpurp-meal-plan-date-change:not(.wpurp-disabled)",function(){var b=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),a=jQuery(RecipeMealPlanner.loader),c=b.find(".wpurp-meal-plan-calendar").data("admin"),f=b.find(".wpurp-meal-plan-calendar").data("meal-plan-id"),h=b.find(".wpurp-meal-plan-calendar").data("start-date"),e=b.find(".wpurp-meal-plan-calendar").data("end-date"),d=b.find(".wpurp-meal-plan-calendar").data("nbr-days");b.find(".wpurp-meal-plan-date").replaceWith(a);
b.find(".wpurp-meal-plan-date-readable").html("&nbsp;");a={action:"meal_planner_change_date",security:wpurp_meal_planner.nonce,admin:c,id:f,start_date:h,end_date:e,nbr_days:d,going_back:jQuery(this).hasClass("wpurp-meal-plan-date-prev")};jQuery.post(wpurp_meal_planner.ajaxurl,a,function(a){b.html(a);RecipeMealPlanner.initSortable(b);RecipeMealPlanner.updateNutritional(b)})});jQuery(".wpurp-meal-plan-recipe-container").sortable({connectWith:".wpurp-meal-plan-recipe-list",placeholder:"wpurp-meal-plan-recipe-placeholder",
stop:function(b,a){jQuery(a.item).parent().hasClass("wpurp-meal-plan-recipe-container")||(jQuery(".wpurp-meal-plan-recipe-container").append(a.item.clone(!0)),RecipeMealPlanner.saveMenu(g),RecipeMealPlanner.updateNutritional(g))}});RecipeMealPlanner.initSortable(g);if(!e)g.on("hover",".wpurp-meal-plan-course .wpurp-meal-plan-header",function(b){"mouseenter"==b.type?jQuery(this).find(".wpurp-meal-plan-actions").show():jQuery(this).find(".wpurp-meal-plan-actions").hide()});g.on("click",".wpurp-course-move:not(.wpurp-disabled)",
function(){var b=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),a=jQuery(this),c=a.closest(".wpurp-meal-plan-course");a.hasClass("wpurp-course-up")?c.insertBefore(c.prev()):c.insertAfter(c.next());RecipeMealPlanner.checkCourseActions();RecipeMealPlanner.saveMenu(b)});g.on("click",".wpurp-course-edit:not(.wpurp-disabled)",function(){var b=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),a=jQuery(this);a.addClass("wpurp-disabled");var c=a.parents(".wpurp-meal-plan-header").find(".wpurp-meal-plan-course-name");
RecipeMealPlanner.getInput(c,"text",c.text(),function(f){a.removeClass("wpurp-disabled");f&&(c.text(f),RecipeMealPlanner.saveMenu(b))})});g.on("click",".wpurp-course-delete:not(.wpurp-disabled)",function(){var b=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),a=jQuery(this);a.addClass("wpurp-disabled");var c=a.parents(".wpurp-meal-plan-header").find(".wpurp-meal-plan-course-name");RecipeMealPlanner.getConfirm(c,wpurp_meal_planner.textDeleteCourse,function(c){a.removeClass("wpurp-disabled");
c&&(a.closest(".wpurp-meal-plan-course").remove(),RecipeMealPlanner.saveMenu(b),RecipeMealPlanner.updateNutritional(b))})});g.on("click",".wpurp-meal-plan-add-course",function(b){b.preventDefault();var a=jQuery(this).parents(".wpurp-meal-plan-calendar-container");RecipeMealPlanner.getInput(jQuery(this),"text","",function(b){if(b){var c=a.find(".wpurp-meal-plan-course-placeholder"),h=c.clone();h.insertBefore(c).addClass("wpurp-meal-plan-course").removeClass("wpurp-meal-plan-course-placeholder").data("course",
b).find(".wpurp-meal-plan-course-name").text(b);h.find(".wpurp-meal-plan-recipe-list").sortable({connectWith:".wpurp-meal-plan-recipe-list",placeholder:"wpurp-meal-plan-recipe-placeholder",stop:function(){RecipeMealPlanner.saveMenu(a)}});RecipeMealPlanner.checkCourseActions();RecipeMealPlanner.saveMenu(a)}})});g.on("click",".wpurp-meal-plan-add-meal-planner",function(b){b.preventDefault();b=jQuery(this).parents(".wpurp-meal-plan-calendar-container");var a=jQuery(this),c=b.find(".wpurp-meal-plan-calendar").data("meal-plan-id");
b=(new Date).toJSON().substring(0,10);RecipeMealPlanner.getDate(a,b,function(b){if(b){b={action:"meal_planner_add_from_meal_plan",security:wpurp_meal_planner.nonce,id:c,date:b};var f=jQuery(RecipeMealPlanner.loader);a.replaceWith(f);jQuery.post(wpurp_meal_planner.ajaxurl,b,function(b){b=jQuery('<span class="wpurp-meal-plan-text"></span>');b.html(wpurp_meal_planner.textAddToMealPlan);f.replaceWith(b)})}})});g.on("click",".wpurp-meal-plan-recipe",function(b){b.stopPropagation();if(!RecipeMealPlanner.wait_for_load){var a=
jQuery(this),c=a.data("type"),f=a.hasClass("wpurp-recipe-selected"),h=a.parents(".wpurp-meal-plan-calendar-container");if(b.shiftKey||b.ctrlKey||b.metaKey){a.toggleClass("wpurp-recipe-selected");var e=h.find(".wpurp-meal-plan-selected-recipe-details");var d=h.find(".wpurp-meal-plan-selected-recipe-details-container");h.find(".recipe-selected").hide();h.find(".recipe-selected-multiple").hide();h.find(".recipe-not-selected").hide();h.find(".recipe-details-loader").hide();d.slideUp(200,function(){e.hide()});
selected_recipes=h.find(".wpurp-recipe-selected");0<selected_recipes.length?h.find(".recipe-selected-multiple").show().find(".selected-number").text(selected_recipes.length):h.find(".recipe-not-selected").show()}else if(h.find(".wpurp-recipe-selected").each(function(){jQuery(this).removeClass("wpurp-recipe-selected")}),f)h.find(".wpurp-recipe-close").click();else{RecipeMealPlanner.editingRecipe&&RecipeMealPlanner.editingRecipe.removeClass("wpurp-recipe-selected");RecipeMealPlanner.editingRecipe=a;
a.addClass("wpurp-recipe-selected");var g=a.data("recipe"),p=a.data("quantity"),l=a.data("servings");b=a.find(".wpurp-meal-plan-recipe-title").text();e=h.find(".wpurp-meal-plan-selected-recipe-details");d=h.find(".wpurp-meal-plan-selected-recipe-details-container");h.find(".recipe-selected").hide().find(".recipe-title").text(b);h.find(".recipe-selected-multiple").hide();h.find(".recipe-not-selected").hide();h.find(".recipe-details-loader").show();RecipeMealPlanner.wait_for_load=!0;d.slideUp(200,function(){jQuery(".wpurp-recipe-close:visible").click();
e.hide();RecipeMealPlanner.getTemplate(c,g,function(b){RecipeMealPlanner.wait_for_load=!1;h.find(".recipe-selected").show();h.find(".recipe-details-loader").hide();d.html(b);d.find(".adjust-recipe-quantity, .advanced-adjust-recipe-quantity").val(p).trigger("change");d.find(".adjust-recipe-servings, .advanced-adjust-recipe-servings").val(l).trigger("change");e.show();d.slideDown(200,function(){void 0!==window.WPURP_Responsive&&WPURP_Responsive.checkBreakpointOfAllElements()})})})}}});g.on("click",
".wpurp-recipe-close",function(){var b=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),a=b.find(".wpurp-meal-plan-selected-recipe-details"),c=b.find(".wpurp-meal-plan-selected-recipe-details-container");b.find(".recipe-selected").hide();b.find(".recipe-selected-multiple").hide();b.find(".recipe-not-selected").show();b.find(".recipe-details-loader").hide();RecipeMealPlanner.editingRecipe.removeClass("wpurp-recipe-selected");c.slideUp(200,function(){a.hide()})});g.on("click",".wpurp-recipe-delete",
function(){var b=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),a=jQuery(this),c=a.parents(".wpurp-meal-plan-header").find(".recipe-selected");RecipeMealPlanner.getConfirm(c,wpurp_meal_planner.textDeleteRecipe,function(c){c&&(RecipeMealPlanner.editingRecipe.remove(),a.siblings(".wpurp-recipe-close").click(),RecipeMealPlanner.saveMenu(b),RecipeMealPlanner.updateNutritional(b))})});g.on("click",".wpurp-recipe-delete-multiple",function(){var b=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),
a=jQuery(this).parents(".wpurp-meal-plan-header").find(".recipe-selected-multiple");RecipeMealPlanner.getConfirm(a,wpurp_meal_planner.textDeleteRecipes,function(a){a&&(b.find(".wpurp-recipe-selected").remove(),b.find(".recipe-selected-multiple").hide(),b.find(".recipe-not-selected").show(),RecipeMealPlanner.saveMenu(b),RecipeMealPlanner.updateNutritional(b))})});g.on("click",".wpurp-recipe-edit-multiple",function(){var b=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),a=jQuery(this).parents(".wpurp-meal-plan-header").find(".recipe-selected-multiple");
RecipeMealPlanner.getInput(a,"number","2",function(a){!isNaN(a)&&0<a&&(b.find(".wpurp-recipe-selected").each(function(){jQuery(this).data("servings",a);jQuery(this).find(".wpurp-meal-plan-recipe-servings").text("("+a+")")}),RecipeMealPlanner.saveMenu(b),RecipeMealPlanner.updateNutritional(b))})});g.on("keyup change",".wpurp-meal-plan-selected-recipe-details .adjust-recipe-quantity, .wpurp-meal-plan-selected-recipe-details .advanced-adjust-recipe-quantity",function(b){b=jQuery(this).parents(".wpurp-meal-plan-calendar-container");
var a=jQuery(this).val();if(isNaN(a)||0>=a)a=1;RecipeMealPlanner.editingRecipe.data("quantity",a);RecipeMealPlanner.editingRecipe.find(".wpurp-meal-plan-recipe-quantity").text(a);RecipeMealPlanner.saveMenu(b);RecipeMealPlanner.updateNutritional(b)});g.on("keyup change",".wpurp-meal-plan-selected-recipe-details .adjust-recipe-servings, .wpurp-meal-plan-selected-recipe-details .advanced-adjust-recipe-servings",function(b){b=jQuery(this).parents(".wpurp-meal-plan-calendar-container");var a=jQuery(this).val();
if(isNaN(a)||0>=a)a=1;RecipeMealPlanner.editingRecipe.data("servings",a);RecipeMealPlanner.editingRecipe.find(".wpurp-meal-plan-recipe-servings").text("("+a+")");RecipeMealPlanner.saveMenu(b);RecipeMealPlanner.updateNutritional(b)});RecipeMealPlanner.printRecipes=function(b){var a=[];jQuery(b).parents(".wpurp-meal-plan").find(".wpurp-meal-plan-recipe").each(function(){if("recipe"==jQuery(this).data("type")){var b=jQuery(this).data("recipe");-1===jQuery.inArray(b,a)&&a.push(b)}});var c=window.open(wpurp_meal_planner.printUrl+
"meal_plan_recipes");jQuery.post(wpurp_meal_planner.ajaxurl,{action:"get_recipe_template",security:wpurp_meal_planner.nonce_print,recipe_ids:a},function(b){for(var a="",f=0,d=b.templates.length;f<d;f++)a+=b.templates[f],a+="<hr>";a=a.slice(0,-4);c.document.getElementsByTagName("body")[0].innerHTML=a;setTimeout(function(){c.print()},200)},"json")};RecipeMealPlanner.printPlan=function(b){var a=jQuery(b).parents(".wpurp-meal-plan"),c=window.open(wpurp_meal_planner.printUrl+"meal_plan");c.onload=function(){c.document.getElementsByTagName("body")[0].innerHTML=
a.html();setTimeout(function(){c.print()},200)}};RecipeMealPlanner.printShoppingList=function(b){var a=jQuery(b).parents(".wpurp-meal-plan-shopping-list-container"),c=window.open(wpurp_meal_planner.printUrl+"meal_plan_shopping_list");c.onload=function(){c.document.getElementsByTagName("body")[0].innerHTML=a.html();setTimeout(function(){c.print()},200)}};g.on("click",".wpurp-meal-plan-shopping-list",function(b){b.preventDefault();var a=jQuery(this).parents(".wpurp-meal-plan-calendar-container"),c=
a.parents(".wpurp-meal-plan").find(".wpurp-meal-plan-shopping-list-container"),f=a.find(".wpurp-meal-plan-calendar").data("meal-plan-id"),h=""+a.find(".wpurp-meal-plan-calendar").data("start-date");b=""+a.find(".wpurp-meal-plan-calendar").data("end-date");a=a.find(".wpurp-meal-plan-calendar").data("nbr-days");h=new Date(h.substring(0,4)+"-"+h.substring(4,6)+"-"+h.substring(6,8));b?(h=new Date("2000-01-01"),b=new Date(b.substring(0,4)+"-"+b.substring(4,6)+"-"+b.substring(6,8))):(b=new Date(h),b.setDate(b.getDate()+
a-1));a=h.toJSON().substring(0,10);b=b.toJSON().substring(0,10);RecipeMealPlanner.getDates(jQuery(this),a,b,function(b,a,h){b&&a&&c.slideUp(200,function(){var d={action:"meal_planner_shopping_list",security:wpurp_meal_planner.nonce,id:f,from:b,to:a,unit_system:h},e=jQuery('<tr><td colspan="2">'+RecipeMealPlanner.loader+"</td></tr>"),g=c.find("tbody"),n=c.find(".wpurp-shopping-list-group-placeholder"),k=c.find(".wpurp-shopping-list-ingredient-placeholder");g.empty().html(e);c.slideDown(400,function(){jQuery.post(wpurp_meal_planner.ajaxurl,
d,function(b){b=RecipeMealPlanner.generateShoppingList(b.ingredients,b.unit_system);b.append(n);b.append(k);g.replaceWith(b);c.find("tbody").sortable({cancel:"input,i",handle:".wpurp-shopping-list-ingredient-name, .wpurp-shopping-list-group-name",helper:function(b,a){a.children().each(function(){jQuery(this).width(jQuery(this).width())});return a}})},"json")})})})});if(!e)d.on("hover",".wpurp-meal-plan-shopping-list tbody tr",function(b){"mouseenter"==b.type?jQuery(this).find(".wpurp-meal-plan-actions").show():
jQuery(this).find(".wpurp-meal-plan-actions").hide()});d.on("click",".wpurp-shopping-list-close",function(){jQuery(this).parents(".wpurp-meal-plan-shopping-list-container").slideUp(200)});d.on("click",".wpurp-group-edit:not(.wpurp-disabled)",function(){var b=jQuery(this);b.addClass("wpurp-disabled");var a=b.parents(".wpurp-shopping-list-group").find(".wpurp-shopping-list-group-name");RecipeMealPlanner.getInput(a,"text",a.text(),function(c){b.removeClass("wpurp-disabled");c&&a.text(c)})});d.on("click",
".wpurp-group-delete:not(.wpurp-disabled)",function(){jQuery(this).closest(".wpurp-shopping-list-group").remove()});d.on("click",".wpurp-ingredient-edit:not(.wpurp-disabled)",function(){var b=jQuery(this);b.addClass("wpurp-disabled");var a=b.parents(".wpurp-shopping-list-ingredient").find(".wpurp-shopping-list-ingredient-name"),c=b.parents(".wpurp-shopping-list-ingredient").find(".wpurp-shopping-list-ingredient-quantity"),f=b.parents(".wpurp-shopping-list-ingredient").find(".wpurp-shopping-list-ingredient-checkbox");
c.hide();f.hide();RecipeMealPlanner.getTwoInput(a,a.text(),c.text(),function(h,d){b.removeClass("wpurp-disabled");if(h||d)a.text(h),c.text(d);c.show();f.show()})});d.on("click",".wpurp-ingredient-delete:not(.wpurp-disabled)",function(){jQuery(this).closest(".wpurp-shopping-list-ingredient").remove()});d.on("click",".wpurp-meal-plan-add-group",function(b){b.preventDefault();var a=jQuery(this).parents(".wpurp-meal-plan-shopping-list-container");RecipeMealPlanner.getInput(jQuery(this),"text","",function(b){if(b){var c=
a.find(".wpurp-shopping-list-group-placeholder");c.clone().insertBefore(c).addClass("wpurp-shopping-list-group").removeClass("wpurp-shopping-list-group-placeholder").find(".wpurp-shopping-list-group-name").text(b)}})});d.on("click",".wpurp-meal-plan-add-ingredient",function(b){b.preventDefault();var a=jQuery(this).parents(".wpurp-meal-plan-shopping-list-container");RecipeMealPlanner.getTwoInput(jQuery(this),"","",function(b,f){if(b||f){var c=a.find(".wpurp-shopping-list-ingredient-placeholder").clone();
c.insertBefore(jQuery(".wpurp-shopping-list-group-placeholder")).addClass("wpurp-shopping-list-ingredient").removeClass("wpurp-shopping-list-ingredient-placeholder").find(".wpurp-shopping-list-ingredient-name").text(b);c.find(".wpurp-shopping-list-ingredient-quantity").text(f)}})});d.on("change",".wpurp-shopping-list-ingredient-checkbox",function(b){b=jQuery(this);b.is(":checked")?b.closest("tr").addClass("ingredient-checked"):b.closest("tr").removeClass("ingredient-checked")});d.on("click",".wpurp-meal-plan-shopping-list-save",
function(b){b.preventDefault();var a=[],c={name:"",ingredients:[]};jQuery(this).parents(".wpurp-meal-plan-shopping-list-container").find(".wpurp-shopping-list-group, .wpurp-shopping-list-ingredient").each(function(b){var f=jQuery(this);f.hasClass("wpurp-shopping-list-group")?(0<b&&a.push(c),c={name:f.find(".wpurp-shopping-list-group-name").text(),ingredients:[]}):c.ingredients.push({name:f.find(".wpurp-shopping-list-ingredient-name").text(),quantity:f.find(".wpurp-shopping-list-ingredient-quantity").text()})});
a.push(c);jQuery.ajax({type:"POST",async:!1,url:wpurp_meal_planner.ajaxurl,data:{action:"meal_planner_shopping_list_save",security:wpurp_meal_planner.nonce,shopping_list:a},success:function(b){window.open(b)}})})};
RecipeMealPlanner.initSelect=function(e){var g=".wpurp-meal-plan-add-recipe";e&&(g+=", .wpurp-meal-plan-add-ingredient-recipe");jQuery(g).select2wpurp({width:"off"}).on("change",function(){var d=jQuery(this);"ingredient"==d.data("type")?RecipeMealPlanner.addIngredient(d.select2wpurp("data")):RecipeMealPlanner.addRecipe(d.select2wpurp("data"));d.select2wpurp("val","")})};
RecipeMealPlanner.initSortable=function(e){jQuery(".wpurp-meal-plan:not(.wpurp-meal-plan-shortcode)").find(".wpurp-meal-plan-recipe-list").sortable({connectWith:".wpurp-meal-plan-recipe-list",placeholder:"wpurp-meal-plan-recipe-placeholder",stop:function(){RecipeMealPlanner.saveMenu(e);RecipeMealPlanner.updateNutritional(e)}})};
RecipeMealPlanner.addIngredient=function(e){if(""!==e.id){var g=jQuery("#wpurp-meal-plan-leftovers").is(":checked"),d=jQuery(".wpurp-meal-plan-recipe-container");d.slideUp(200,function(){d.find(".wpurp-meal-plan-recipe").remove();var b=Math.floor(1E6*Math.random()),a='<div class="wpurp-meal-plan-recipe wpurp-meal-plan-recipe-'+b+'" data-name="'+e.text+'" data-placeholder="true">',a=a+('<span class="wpurp-meal-plan-recipe-title">'+(g?e.text+" ("+wpurp_meal_planner.textLeftovers+")":e.text)+"</span>")+
"</div>";d.append(a);d.slideDown(400);jQuery.post(wpurp_meal_planner.ajaxurl,{action:"get_ingredient_meal_plan_data",security:wpurp_meal_planner.nonce,ingredient_id:e.id},function(a){if(a.success){a=a.data.ingredient;var c=jQuery("#wpurp-meal-plan-leftovers").is(":checked"),d=jQuery(".wpurp-meal-plan-recipe-"+b);d.removeClass("wpurp-meal-plan-recipe-"+b).data("placeholder","").data("type","ingredient").data("recipe",a.id).data("name",a.name).data("quantity","1").data("servings",a.servings_original).data("nutrition",
a.nutrition).data("leftovers",c);d.html('<span class="wpurp-meal-plan-recipe-quantity">1</span>x '+('<span class="wpurp-meal-plan-recipe-title">'+(c?a.name+" ("+wpurp_meal_planner.textLeftovers+")":a.name)+"</span>")+(' <span class="wpurp-meal-plan-recipe-servings">('+a.servings_original+")</span>"));a=d.parents(".wpurp-meal-plan-calendar-container");RecipeMealPlanner.updateNutritional(a);RecipeMealPlanner.saveMenu(a)}},"json")})}};
RecipeMealPlanner.addRecipe=function(e){if(""!==e.id){RecipeMealPlanner.getRecipeTemplate(e.id);var g=jQuery("#wpurp-meal-plan-leftovers").is(":checked"),d=jQuery(".wpurp-meal-plan-recipe-container");d.slideUp(200,function(){d.find(".wpurp-meal-plan-recipe").remove();var b=Math.floor(1E6*Math.random()),a='<div class="wpurp-meal-plan-recipe wpurp-meal-plan-recipe-'+b+'" data-name="'+e.text+'" data-placeholder="true">',a=a+('<span class="wpurp-meal-plan-recipe-title">'+(g?e.text+" ("+wpurp_meal_planner.textLeftovers+
")":e.text)+"</span>")+"</div>";d.append(a);d.slideDown(400);jQuery.post(wpurp_meal_planner.ajaxurl,{action:"get_recipe_meal_plan_data",security:wpurp_meal_planner.nonce,recipe_id:e.id},function(a){if(a.success){a=a.data.recipe;var c=jQuery("#wpurp-meal-plan-leftovers").is(":checked"),d=jQuery(".wpurp-meal-plan-recipe-"+b);d.removeClass("wpurp-meal-plan-recipe-"+b).data("placeholder","").data("type","recipe").data("recipe",a.id).data("name",a.name).data("quantity","1").data("servings",a.servings_original).data("nutrition",
a.nutrition).data("leftovers",c);var c=c?a.name+" ("+wpurp_meal_planner.textLeftovers+")":a.name,e="";a.image&&(e+='<img src="'+a.image+'">');e=e+('<span class="wpurp-meal-plan-recipe-title">'+c+"</span>")+(' <span class="wpurp-meal-plan-recipe-servings">('+a.servings_original+")</span>");d.html(e);a=d.parents(".wpurp-meal-plan-calendar-container");RecipeMealPlanner.updateNutritional(a);RecipeMealPlanner.saveMenu(a)}},"json")})}};
RecipeMealPlanner.getTemplate=function(e,g,d){return"ingredient"==e?RecipeMealPlanner.getIngredientTemplate(g,d):RecipeMealPlanner.getRecipeTemplate(g,d)};
RecipeMealPlanner.getIngredientTemplate=function(e,g){var d='<div style="padding: 0 20px;">'+(wpurp_meal_planner.textQuantity+': <input type="number" min="1" class="advanced-adjust-recipe-quantity" value="1" style="width:40px !important;padding:2px !important;background:white !important;border:1px solid #bbbbbb !important;"></br>');d+=wpurp_meal_planner.textServings+': <input type="number" min="1" class="advanced-adjust-recipe-servings" value="1" style="width:40px !important;padding:2px !important;background:white !important;border:1px solid #bbbbbb !important;">';
g(d+"</div>")};RecipeMealPlanner.getRecipeTemplate=function(e,g){void 0==RecipeMealPlanner.templates[e]?jQuery.post(wpurp_meal_planner.ajaxurl,{action:"get_recipe_template",security:wpurp_meal_planner.nonce,recipe_id:e},function(d){RecipeMealPlanner.templates[e]=d.output;void 0!==g&&g(d.output)},"json"):void 0!==g&&g(RecipeMealPlanner.templates[e])};
RecipeMealPlanner.groupBy=function(e){var g=jQuery(RecipeMealPlanner.loader);jQuery(".wpurp-meal-plan-group-by-container").append(g);jQuery.post(wpurp_meal_planner.ajaxurl,{action:"meal_planner_groupby",security:wpurp_meal_planner.nonce,groupby:e,grid:wpurp_meal_planner_grid.slug},function(d){g.remove();jQuery(".wpurp-meal-plan-add-recipe").select2wpurp("destroy").off().html(d);RecipeMealPlanner.initSelect(!1)})};
RecipeMealPlanner.checkCourseActions=function(){var e=jQuery(".wpurp-meal-plan-course");e.each(function(g,d){jQuery(d).find(".wpurp-course-move").removeClass("wpurp-disabled");0==g?jQuery(d).find(".wpurp-course-up").addClass("wpurp-disabled"):g==e.length-1&&jQuery(d).find(".wpurp-course-down").addClass("wpurp-disabled")})};
RecipeMealPlanner.getInput=function(e,g,d,b){var a=jQuery('<form class="wpurp-meal-plan-form"></form>'),c=jQuery('<input type="'+g+'" class="wpurp-meal-plan-input">'),f=jQuery('<button type="submit" class="wpurp-meal-plan-button"><i class="fa fa-check"></i></button>'),h=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-close"></i></button>');a.append(c).append(f).append(h);e.hide().after(a);c.val(d);c.focus().select();a.on("submit",function(d){d.preventDefault();d.stopPropagation();d=
c.val();e.show();a.remove();"number"==g?b(parseInt(d)):b(d.trim())});h.on("click",function(c){c.preventDefault();c.stopPropagation();e.show();a.remove();b("")})};
RecipeMealPlanner.getTwoInput=function(e,g,d,b){var a=jQuery('<form class="wpurp-meal-plan-form"></form>'),c=jQuery('<input type="text" class="wpurp-meal-plan-input">'),f=jQuery('<input type="text" class="wpurp-meal-plan-input">'),h=jQuery('<button type="submit" class="wpurp-meal-plan-button"><i class="fa fa-check"></i></button>'),n=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-close"></i></button>');a.append(c).append(f).append(h).append(n);e.hide().after(a);c.val(g);f.val(d);c.focus().select();
a.on("submit",function(d){d.preventDefault();d.stopPropagation();d=c.val();var h=f.val();e.show();a.remove();b(d.trim(),h.trim())});n.on("click",function(c){c.preventDefault();c.stopPropagation();e.show();a.remove();b("")})};
RecipeMealPlanner.getConfirm=function(e,g,d){var b=jQuery('<form class="wpurp-meal-plan-form"></form>');g=jQuery('<span class="wpurp-meal-plan-form-message">'+g+"</span>");var a=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-check"></i></button>'),c=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-close"></i></button>');b.append(g).append(a).append(c);e.hide().after(b);a.on("click",function(a){a.preventDefault();a.stopPropagation();e.show();b.remove();d(!0)});c.on("click",
function(a){a.preventDefault();a.stopPropagation();e.show();b.remove();d(!1)})};
RecipeMealPlanner.getDate=function(e,g,d){var b=jQuery('<form class="wpurp-meal-plan-form"></form>'),a=jQuery('<input type="text" class="wpurp-meal-plan-input wpurp-meal-plan-input-date">'),c=jQuery('<button type="submit" class="wpurp-meal-plan-button"><i class="fa fa-check"></i></button>'),f=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-close"></i></button>');b.append(a).append(c).append(f);e.hide().after(b);a.val(g);a.datepicker({monthNames:wpurp_meal_planner.datepicker.monthNames,
monthNamesShort:wpurp_meal_planner.datepicker.monthNamesShort,dayNames:wpurp_meal_planner.datepicker.dayNames,dayNamesShort:wpurp_meal_planner.datepicker.dayNamesShort,dayNamesMin:wpurp_meal_planner.datepicker.dayNamesMin,dateFormat:wpurp_meal_planner.datepicker.dateFormat,firstDay:wpurp_meal_planner.datepicker.firstDay,isRTL:wpurp_meal_planner.datepicker.isRTL});b.on("submit",function(c){c.preventDefault();c.stopPropagation();c=a.val();e.show();b.remove();d(c.trim())});f.on("click",function(a){a.preventDefault();
a.stopPropagation();e.show();b.remove();d("")})};
RecipeMealPlanner.getDates=function(e,g,d,b){for(var a=jQuery('<form class="wpurp-meal-plan-form"></form>'),c=jQuery('<input type="text" class="wpurp-meal-plan-input wpurp-meal-plan-input-date">'),f=jQuery('<input type="text" class="wpurp-meal-plan-input wpurp-meal-plan-input-date">'),h=jQuery('<select class="wpurp-meal-plan-input wpurp-meal-plan-input-unit-system"></select>'),n=jQuery('<button type="submit" class="wpurp-meal-plan-button"><i class="fa fa-check"></i></button>'),m=jQuery('<button class="wpurp-meal-plan-button"><i class="fa fa-close"></i></button>'),
k=0,p=wpurp_unit_conversion.systems.length;k<p;k++)h.append(jQuery('<option value="'+k+'"'+(k==wpurp_meal_planner.default_unit_system?" selected":"")+">"+wpurp_unit_conversion.systems[k].name+"</option>"));k=jQuery('<span class="wpurp-meal-plan-input-dates"></span>').append(c).append(" - ").append(f);a.append(k).append(h).append(n).append(m);e.hide().after(a);c.val(g);f.val(d);c.datepicker({monthNames:wpurp_meal_planner.datepicker.monthNames,monthNamesShort:wpurp_meal_planner.datepicker.monthNamesShort,
dayNames:wpurp_meal_planner.datepicker.dayNames,dayNamesShort:wpurp_meal_planner.datepicker.dayNamesShort,dayNamesMin:wpurp_meal_planner.datepicker.dayNamesMin,dateFormat:wpurp_meal_planner.datepicker.dateFormat,firstDay:wpurp_meal_planner.datepicker.firstDay,isRTL:wpurp_meal_planner.datepicker.isRTL});f.datepicker({monthNames:wpurp_meal_planner.datepicker.monthNames,monthNamesShort:wpurp_meal_planner.datepicker.monthNamesShort,dayNames:wpurp_meal_planner.datepicker.dayNames,dayNamesShort:wpurp_meal_planner.datepicker.dayNamesShort,
dayNamesMin:wpurp_meal_planner.datepicker.dayNamesMin,dateFormat:wpurp_meal_planner.datepicker.dateFormat,firstDay:wpurp_meal_planner.datepicker.firstDay,isRTL:wpurp_meal_planner.datepicker.isRTL});a.on("submit",function(d){d.preventDefault();d.stopPropagation();d=c.val();var g=f.val(),k=h.val();e.show();a.remove();b(d.trim(),g.trim(),k)});m.on("click",function(c){c.preventDefault();c.stopPropagation();e.show();a.remove();b("","")});"1"!=wpurp_meal_planner.adjustable_system&&(h.hide(),"none"==k.css("display")&&
a.submit())};
RecipeMealPlanner.saveMenu=function(e){e=e.find(".wpurp-meal-plan-calendar");var g=e.data("meal-plan-id"),d=e.data("start-date"),b=e.data("nbr-days"),a=[];e.find(".wpurp-meal-plan-course").each(function(b){var c=jQuery(this),d=c.find(".wpurp-meal-plan-course-name").text(),e=[];c.find(".wpurp-meal-plan-recipe-list").each(function(a){var b=[];jQuery(this).find(".wpurp-meal-plan-recipe").each(function(a){var c=jQuery(this);if("true"!=c.data("placeholder")){var d=c.data("type"),e=c.data("recipe"),f=c.data("quantity"),
g=c.data("servings"),c=c.data("leftovers");b[a]={type:d,id:e,quantity:f,servings:g,leftovers:c}}});e[a]=b});a[b]={name:d,days:e}});var c={id:g,start_date:d,nbr_days:b,courses:a};clearTimeout(RecipeMealPlanner.ajaxUpdateTimer);RecipeMealPlanner.ajaxUpdateTimer=setTimeout(function(){RecipeMealPlanner.ajaxSaveMenu(c)},1E3)};
RecipeMealPlanner.ajaxSaveMenu=function(e){jQuery.post(wpurp_meal_planner.ajaxurl,{action:"meal_planner_save",security:wpurp_meal_planner.nonce,security_admin:wpurp_meal_planner.nonce_admin,menu:e},function(e){})};
RecipeMealPlanner.generateShoppingList=function(e,g){for(var d,b,a,c,f,h=[],n=[],m=236.6,k=0,p=wpurp_unit_conversion.systems.length;k<p;k++)f=wpurp_unit_conversion.systems[k],-1!=jQuery.inArray("cup",f.units_volume)&&(m=parseFloat(f.cup_type));k=0;for(p=e.length;k<p;k++){f=e[k];void 0===n[f.name]&&(n[f.name]=f.plural);void 0===h[f.group]&&(h[f.group]=[]);void 0===h[f.group][f.name]&&(h[f.group][f.name]=[]);a=f.amount;c=f.unit;var l=RecipeUnitConversion.getUnitFromAlias(f.unit);void 0!==l&&"1"==wpurp_meal_planner.consolidate_ingredients&&
(c=RecipeUnitConversion.getAbbreviation(l),"cup"==c&&(l=(new Qty("1 cup")).to("ml").scalar,.1<Math.abs(m-l)&&(a*=m/l)),b=new Qty(""+a+" "+c),a=b.toBase(),"m3"==a.units()&&(a=a.to("l")),c=a.units(),a=a.scalar);""==c&&(c="wpurp_nounit");void 0===h[f.group][f.name][c]&&(h[f.group][f.name][c]=0);h[f.group][f.name][c]+=parseFloat(a)}m=Object.keys(h);m.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())});l=jQuery("<tbody></tbody>");k=0;for(p=m.length;k<p;k++){f=m[k];var x=h[f];f=jQuery('<tr class="wpurp-shopping-list-group"><td colspan="2"><span class="wpurp-shopping-list-group-name">'+
f+'</span><span class="wpurp-meal-plan-actions"><i class="fa fa-pencil wpurp-group-edit"></i><i class="fa fa-trash wpurp-group-delete"></i></span></td></tr>');l.append(f);var t=Object.keys(x);t.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())});for(var u=0,A=t.length;u<A;u++){f=t[u];var y=x[f];for(c in y)if(a=y[c],isFinite(a)){for(var v=jQuery('<tr class="wpurp-shopping-list-ingredient"></tr>'),q=RecipeUnitConversion.getUnitFromAlias(c),w=[g],z=!1,r=0;r<w.length;r++){d=a;b=
c;"wpurp_nounit"==c?b="":void 0===q||"1"!=wpurp_meal_planner.consolidate_ingredients&&(RecipeUnitConversion.isUniversal(q)||-1!=jQuery.inArray(w[r],RecipeUnitConversion.getUnitSystems(q)))||(b=RecipeUnitConversion.convertUnitToSystem(a,q,0,w[r]),d=b.amount,b=RecipeUnitConversion.getUserAbbreviation(b.unit,d));d=RecipeUnitConversion.formatNumber(d,wpurp_meal_planner.fractions);if(1<parseFloat(d)||0==parseFloat(d)||""!==b)z=!0;v.append('<td><span class="wpurp-shopping-list-ingredient-quantity">'+d+
" "+b+'</span><span class="wpurp-meal-plan-actions"><i class="fa fa-pencil wpurp-ingredient-edit"></i><i class="fa fa-trash wpurp-ingredient-delete"></i></span></td>')}a=z?n[f]:f;a=a.charAt(0).toUpperCase()+a.slice(1);d="";"1"==wpurp_meal_planner.checkboxes&&(d='<input type="checkbox" class="wpurp-shopping-list-ingredient-checkbox"> ');v.prepend("<td>"+d+'<span class="wpurp-shopping-list-ingredient-name">'+a+"</span></td>");l.append(v)}}}return l};
RecipeMealPlanner.updateNutritional=function(e){for(var g,d=e.find(".wpurp-meal-plan-nutrition"),b={},a=0,c=wpurp_meal_planner.nutrition_facts_fields.length;a<c;a++)g=wpurp_meal_planner.nutrition_facts_fields[a],b[g+"_per_day"]=[];var f=[];if(0<d.length){e.find(".wpurp-meal-plan-course").each(function(a){jQuery(this).find(".wpurp-meal-plan-recipe-list").each(function(a){for(var c=0,d=wpurp_meal_planner.nutrition_facts_fields.length;c<d;c++){var e=wpurp_meal_planner.nutrition_facts_fields[c];void 0==
b[e+"_per_day"][a]&&(b[e+"_per_day"][a]=0)}void 0==f[a]&&(f[a]=0);jQuery(this).find(".wpurp-meal-plan-recipe").each(function(c){var d=jQuery(this);c=d.data("type");for(var e=parseFloat(d.data("quantity")),g=parseFloat(d.data("servings")),d=d.data("nutrition")||"",d=d.split(";"),h,k=!1,l=0,n=wpurp_meal_planner.nutrition_facts_fields.length;l<n;l++){var m=wpurp_meal_planner.nutrition_facts_fields[l];h=parseFloat(d[l])||0;"ingredient"==c&&(h*=e/g);"1"==wpurp_meal_planner.nutrition_facts_total&&(h*=g);
0<h&&(k=!0);b[m+"_per_day"][a]+=h}k||(f[a]+=1)})})});if("kilojoules"==wpurp_meal_planner.nutrition_facts_calories_type&&void 0!==b.calories_per_day)for(a=0,c=b.calories_per_day.length;a<c;a++)b.calories_per_day[a]=parseInt(4.1868*b.calories_per_day[a]);a=0;for(c=wpurp_meal_planner.nutrition_facts_fields.length;a<c;a++)g=wpurp_meal_planner.nutrition_facts_fields[a],e=d.find(".wpurp-meal-plan-nutrition-facts-"+g),0<e.length&&e.find("td").each(function(a){a=parseInt(b[g+"_per_day"][a])||0;jQuery(this).find(".wpurp-meal-plan-nutrition-value").text(a)});
d.find(".wpurp-meal-plan-nutrition-facts-missing").find("td").each(function(a){0<f[a]?(jQuery(this).find(".wpurp-meal-plan-nutrition-missing-value").text(f[a]),jQuery(this).find(".wpurp-meal-plan-nutrition-missing").show()):jQuery(this).find(".wpurp-meal-plan-nutrition-missing").hide()})}};RecipeMealPlanner.updateNutritionalValues=function(e,g){0<e.length&&e.find("td").each(function(d){d=parseInt(g[d])||0;jQuery(this).find(".wpurp-meal-plan-nutrition-value").text(d)})};
jQuery(document).ready(function(){0<jQuery(".wpurp-meal-plan").length&&RecipeMealPlanner.init()});